views:

67

answers:

0

i'm using the following code but getting the error: Twitter returned an API error but TweetSharp was unable to parse it.

my code is:

 var request = GetRequestToken();
    //--
    TwitterService service = new TwitterService();
    OAuthToken unauthorizedToken = service.GetRequestToken(_consumerKey, _consumerSecret);
    string url = service.GetAuthorizationUrl(unauthorizedToken);

    OAuthToken authToken = service.GetAccessToken(_consumerKey, _consumerSecret, request);
    service.AuthenticateWith(authToken.Token, authToken.TokenSecret);
    if (service.Error == null)
    {
        TwitterStatus status = service.SendTweet("I just ranked for"));
    }}


 private OAuthToken GetRequestToken()
{       
     var requestToken = FluentTwitter.CreateRequest()
    .Authentication.GetRequestToken(_consumerKey, _consumerSecret);

    var response = requestToken.Request();
    var result = response.AsToken();

    if (result == null)
    {
        var error = response.AsError();
        if (error != null)
        {
            throw new Exception(error.ErrorMessage);
        }
    }

    return result;
}

related questions