Oauth/request_token


#1

how can we get the token via “oauth/request_token” using simple js or via a rest client. what all params are used.


#2

Not that this answers the “how” but take a look at https://dev.twitter.com/oauth/reference/post/oauth/request_token. At the bottom of the page you see the POST request that is being made to get a token. If you are using JavaScript you might want to make use of a library like jsOAuth since the calculation of the hash element is not trivial. The twitter documentation is light, but given that it’s based on an industry standard you can find plenty of information on it when looking at the standards documentation itself.

var options = {
    consumerKey:'<your key>',
    consumerSecret:'<your secret>',
    requestTokenUrl: "https://api.twitter.com/oauth/request_token",
    authorizationUrl:"https://api.twitter.com/oauth/authorize",
    accessTokenUrl:  "https://api.twitter.com/oauth/access_token",
    method: 'POST'
};
var oauth = new OAuth(options);
oauth.fetchRequestToken(function(u) {
    console.dir(u);
});