TweetSharp getRequestToken returns no token


#1

Hi,

I am using TweetSharp to get the request token for my app in the following way :

TwitterClientInfo clientInfo = GetClientInfo(consumerKey, consumerSecret);
TwitterService service = new TwitterService(clientInfo);
TweetSharp.OAuthRequestToken requestToken = service.GetRequestToken(redirectURL);
string redirectUrl = service.GetAuthorizationUri(requestToken, redirectURL).AbsoluteUri();

However, the redirectUrl I get looks like this :

https://api.twitter.com/oauth/authorize?oauth_token=?&oauth_callback=http://www.domain.com/mycallback.aspx

As you can see, I can’t get an oauth_token in the url, so I get an error while redirecting to that page.

In development and testing environments, it works well, just fails in production.

Any idea ?

Thank you,
Simon


#2

Have you looked closely as to what’s happening in the request token step here? Added additional logging and or exception handling? It’s likely an environmental problem – an off clock, bad SSL support, or other kind of issue you may be running into.

Also, oauth_callback doesn’t belong on the oauth/authorize step – only oauth/request_token


#3

I’m getting the same problem - not sure why this just started happening. The GetRequestToken was rock solid.


#4

I am having the same issues not sure why I never get the token back. here is the code i am using. Can someone help please?

public class HomeController : Controller
{
private string consumerKey = System.Configuration.ConfigurationManager.AppSettings.Get(“ConsumerKey”);
private string consumerSecret = System.Configuration.ConfigurationManager.AppSettings.Get(“ConsumerSecret”);

    public ActionResult Index()
    {
        ViewBag.Message = "Welcome";

        return View();
    }

    [HttpPost]
    public ActionResult Auth()
    {

        TwitterService twitterService = new TwitterService(
            consumerKey, consumerSecret);

        OAuthRequestToken authRequestToken = twitterService.GetRequestToken(http://127.0.0.1:48293/Home/AuthorizeCallback");

        Uri uri = twitterService.GetAuthenticationUrl(authRequestToken);
        return Redirect(uri.ToString());
    }

    [HttpPost]
    public ActionResult AuthorizeCallback(string authToken, string auth_Verifier)
    {
        var authRequestToken = new OAuthRequestToken { Token = authToken };

        TwitterService twitterService = new TwitterService(consumerKey, consumerSecret);
        OAuthAccessToken authAccessToken = twitterService.GetAccessToken(authRequestToken, auth_Verifier);

        twitterService.AuthenticateWith(authAccessToken.Token, authAccessToken.TokenSecret);

        TwitterUser twitterUser = twitterService.VerifyCredentials();

        ViewBag.Message = string.Format("Your username is {0}", twitterUser.ScreenName);

        return View();
    }

#5

Guys i Just want to know how to request token… im drupal user and having problema on request token im using a localhost. can any teach what to do
thanks


#6

Anyone find out why somtimes no token is returned?