Sign In with Twitter error:Failed to validate oauth signature and token


Hi All

I’ve been working on this for 3 days now, I’m not that advance in programming but I get around and have recently started learning mvc C# So what I’m trying to do exactly is allow users to sign in using twitter to this web site I’m creating but have had no luck I am really unsure of whats happening and the cause of it.

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: “
Failed to validate oauth signature and token

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

Heres my code:

Collapse | Copy Code
public ActionResult Tweeter()
TwitterService service = new TwitterService(ConsumerKey, ConsumerSecret);

        OAuthRequestToken requestToken = service.GetRequestToken("");
        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");