user372724
user372724

Reputation:

Could not authenticate with OAuth

I am using Tweetsharp and I am trying to play with the Twitter Application. At present it is a simple console application.

I have searched in the net and found some articles where most of them are stating that after August 16th 2010, the basic authentication for the twitter is no longer applicable. Instead OAuth has come into place.

Henceforth, I have gone to the Twitter Apps and created one for me.(since it's a desktop application, so I choose Application Type to be Client and not browser.)

These are the various information that I got

Consumer key :  NxDgjunKLu65CW38Ea1RT 

Consumer secret :JOomsRGPTHct9hFjGQOTpxScZwI5K8zkIpOC1ytfo 

Request token URL : https://twitter.com/oauth/request_token

Access token URL :  https://twitter.com/oauth/access_token

Authorize URL:  https://twitter.com/oauth/authorize

As a very basic step what have planned is that, I will write/post some tweet something to my wall.

Henceforth, I made the following(some code has been taken from web as I was using those as a reference)

string consumerKey = "NxDgjunKLu65CW38Ea1RT";
string consumerSecret = "JOomsRGPTHct9hFjGQOTpxScZwI5K8zkIpOC1ytfo";

FluentTwitter.SetClientInfo(new TwitterClientInfo { ConsumerKey = consumerKey, ConsumerSecret = consumerSecret });

//Gets the token
var RequestToken = FluentTwitter.CreateRequest().Authentication.GetRequestToken().Request().AsToken();

var twitter = FluentTwitter.CreateRequest()
                        .AuthenticateWith(
                        consumerKey
                        ,consumerSecret,
                        RequestToken.Token,
                        RequestToken.TokenSecret)
                        .Statuses().Update("I am writing my first tweets").AsXml();
var response = twitter.Request();
var status = response.AsStatus();

But the response is

<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <error>Could not authenticate with OAuth.</error>
  <request>/1/statuses/update.xml</request>
</hash>

I am trying for a long time to understand the problem but all in vain.

I need help.

Thanks

Upvotes: 1

Views: 2209

Answers (1)

Stephen Dryden
Stephen Dryden

Reputation: 571

Getting the request token is only the first step of the OAuth process. You need to get the request token, authorize the token, and then trade if for an access token. You then use the access token to send a tweet.

See this link for a flowchart of the full OAuth process.

Upvotes: 2

Related Questions