Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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: "
Quote:
Failed to validate oauth signature and token
"

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

Heres my code:

C#
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
Posted

1 solution

 
Share this answer
 
Comments
Manfred Rudolf Bihy 6-Jun-13 11:19am    
Nice links, thanks! 5+
ridoy 6-Jun-13 11:45am    
Thanks..:)
Maciej Los 6-Jun-13 12:10pm    
Agree with Manfred. Have a 5 from me ;)
ridoy 6-Jun-13 12:59pm    
Thanks Maciej..:)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900