使用tweeter登录我的应用程序 [英] Using tweeter to sign in my app

查看:89
本文介绍了使用tweeter登录我的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我正在尝试让用户使用他们的谷歌+ Facebook和Twitter帐户登录,但没有运气我真的不确定发生了什么及其原因。



场景:
来自我的网站的
当用户点击使用Twitter帐户按钮登录时,他被重定向到twitters登录页面并从那里可以成功登录但是,我遇到的问题是,在点击Twitter上的登录按钮后,它会将用户登录并立即在不到一秒的时间内将我重定向到显示此错误的空白网页msg:

Hi
I'm trying to enable users to login with their google+ facebook and twitter account but have had no luck I am really unsure of whats happening and the cause of it.

Scenario:
from my site when user clicks the sign in with twitter account button he is redirected to twitters login page and from there can successfully sign in but, the problem I'm having is that after clicking the login button on twitter it logs the user in and immediately in less than a Second redirects me to a blank web page displaying this error msg: "

引用:

无法验证oauth签名和令牌

Failed to validate oauth signature and token





我不确定什么导致这个任何帮助都会有所帮助。



继承人我的代码:



"

I'm not sure whats causing this any assistance would help.

Heres my code:

public ActionResult Tweeter()
       {
           TwitterService service = new TwitterService(ConsumerKey, ConsumerSecret);

           OAuthRequestToken requestToken = service.GetRequestToken("https://api.twitter.com/oauth/request_token");

           Uri uri = service.GetAuthorizationUri(requestToken);
           return new RedirectResult(uri.ToString());
       }

       public ActionResult AuthorizeCallback( string oauth_token, string oauth_verifier)
       {
           var requestToken = new OAuthRequestToken { Token = oauth_token};

           TwitterService service = new TwitterService(ConsumerKey, ConsumerSecret);
           OAuthAccessToken accessToken = service.GetAccessToken(requestToken, oauth_verifier);

           service.AuthenticateWith(accessToken.Token, accessToken.TokenSecret);
           TwitterUser user = service.VerifyCredentials(new VerifyCredentialsOptions());
           string email_user = string.Format(user.ScreenName);
           FormsAuthentication.SetAuthCookie(email_user, false);

           return View("Index", "Home");
       }







关注




Regards

推荐答案

查看这些链接对您有所帮助..

http://www.aspdotnet-suresh.com/2012/05/add-twitter-login-authentication-to.html [ ^ ]

http://www.voiceoftech.com/swhitley/?p=681 [ ^ ]
See these links which will help you..
http://www.aspdotnet-suresh.com/2012/05/add-twitter-login-authentication-to.html[^]
http://www.voiceoftech.com/swhitley/?p=681[^]


这篇关于使用tweeter登录我的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆