微博认证的ServiceStack [英] Twitter Authentication in ServiceStack
问题描述
我在ServiceStack服务加入Twitter的认证。我的验证,以及服务工作正常并且我得到重定向到Twitter的认证页面我的服务页面成功响应。但我不能这样整我的用户界面下集成。有按钮单击事件我想从Twitter的成功验证,之后想从基于我的服务响应,我会重定向到我的第二个网页。
这里是我的web.config code ..
I added twitter Authentication in my ServiceStack Service. My Authentication as well as Service is working fine and i am getting redirected to my Service Page from Twitter Authentication page with success response. But i am not able to integrate this whole with my User Interface. There on button click event i want to successfully authenticated from twitter and after that want to get response from my service based on that i would redirect to my second webpage. Here is my web.config code..
<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://本地主机:49661 /查看/ Home.html中
Once the twitter Authentication is done i want my login page to redirect to http://localhost:49661/Views/Home.html
.
下面就是我如何努力采用了棱角分明的JS,但它不是发生的事情。身份验证发生,但我没有得到服务响应警报,并没有能够导航到第二个网页。
Here is how i am trying to do using angular JS but its not happening . Authentication is happening but i am not getting Service response alert and neither able to navigate to second webpage.
$window.location.href = 'http://localhost:64132/auth/twitter';
$http.get("http://localhost:64132/Login")
.success(function (response) { alert(response.loginMessage); });
请帮我.Thanks ..
Please help me .Thanks..
推荐答案
查看不同的方式来指定重定向网址认证之后,例如,你可以使用?继续= /首页
参数来指定要验证后重定向到。
See this previous answer on different ways to specify the redirect url after authentication, e.g you can use the ?Continue=/Home
parameter to specify where to redirect to after authentication.
请注意/浏览次数文件夹是的View 页面不能被直接重定向,即他们是在查看页呈现为调用服务的结果,例如: /家居
。外什么/浏览次数
是内容页,可以直接申请。
Note if you're using ServiceStack.Razor feature, the /Views
folder is a special location for View Pages which can't be redirected to directly, i.e. they're the View Page rendered as a result of calling a Service, e.g. /home
. Anything outside /Views
is a Content Page that can be requested directly.
这篇关于微博认证的ServiceStack的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!