Twitter Authentication in ServiceStack

最后都变了- 提交于 2019-12-25 07:13:49

问题


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" />

Once the twitter Authentication is done i want my login page to redirect to http://localhost:49661/Views/Home.html.

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); });

Please help me .Thanks..


回答1:


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.

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.



来源:https://stackoverflow.com/questions/32608817/twitter-authentication-in-servicestack

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!