【问题标题】:Twitter Authentication in ServiceStackServiceStack 中的 Twitter 身份验证
【发布时间】:2015-09-16 12:36:38
【问题描述】:

我在我的 ServiceStack 服务中添加了 twitter 身份验证。我的身份验证和服务工作正常,我从 Twitter 身份验证页面重定向到我的服务页面并获得成功响应。但我无法将这一切与我的用户界面集成。在按钮单击事件中,我想成功地从 twitter 进行身份验证,然后希望从我的服务中获得响应,基于此我将重定向到我的第二个网页。 这是我的 web.config 代码..

<appSettings>
<!-- servicestack oauth config -->
<add key ="oauth.twitter.ConsumerKey" value="yqeybHSZLzNZjXXtA44XZQ" />
<add key ="oauth.twitter.ConsumerSecret" value="dPHZv3V28OtbK93FM54upAtzoEymLQMbtBqufPuL4" />
<!-- local dev config -->
<add key ="oauth.twitter.RedirectUrl" value="http://localhost:64132/Login" />
<add key ="oauth.twitter.CallbackUrl" value="http://localhost:64132/auth/twitter" />

完成 twitter 身份验证后,我希望我的登录页面重定向到 http://localhost:49661/Views/Home.html

这是我尝试使用 Angular JS 的方法,但它没有发生。正在进行身份验证,但我没有收到服务响应警报,也无法导航到第二个网页。

$window.location.href = 'http://localhost:64132/auth/twitter';

$http.get("http://localhost:64132/Login")
.success(function (response) { alert(response.loginMessage); });

请帮助我。谢谢..

【问题讨论】:

    标签: angularjs authentication twitter servicestack servicestack-auth


    【解决方案1】:

    在身份验证后查看different ways to specify the redirect url 上的此先前答案,例如,您可以使用?Continue=/Home 参数指定身份验证后重定向到的位置。

    请注意,如果您使用 ServiceStack.Razor 功能,/Views 文件夹是 View Pages 的特殊位置,不能直接重定向到,即它们是 查看页面作为调用服务的结果呈现,例如/home/Views 之外的任何内容都是可以直接请求的内容页面

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-07-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-22
      • 1970-01-01
      相关资源
      最近更新 更多