Support for passing extra parameters when getting a request token. Changed getOAuthAccessToken
to always expect an oauth_verifier
value (although it could be null
).
This commit is contained in:
parent
e38ab951f1
commit
c8393eb053
16
lib/oauth.js
16
lib/oauth.js
@ -233,8 +233,12 @@ exports.OAuth.prototype._performSecureRequest= function( oauth_token, oauth_toke
|
|||||||
request.end();
|
request.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.OAuth.prototype.getOAuthAccessToken= function(oauth_token, oauth_token_secret, callback) {
|
exports.OAuth.prototype.getOAuthAccessToken= function(oauth_token, oauth_token_secret, oauth_verifier, callback) {
|
||||||
this._performSecureRequest( oauth_token, oauth_token_secret, "GET", this._accessUrl, null, function(error, data, response) {
|
var extraParams = {};
|
||||||
|
if( oauth_verifier ) {
|
||||||
|
extraParams.oauth_verifier = oauth_verifier;
|
||||||
|
}
|
||||||
|
this._performSecureRequest( oauth_token, oauth_token_secret, "GET", this._accessUrl, extraParams, function(error, data, response) {
|
||||||
if( error ) callback(error);
|
if( error ) callback(error);
|
||||||
else {
|
else {
|
||||||
var results= querystring.parse( data );
|
var results= querystring.parse( data );
|
||||||
@ -250,8 +254,12 @@ exports.OAuth.prototype.getProtectedResource= function(url, method, oauth_token,
|
|||||||
this._performSecureRequest( oauth_token, oauth_token_secret, method, url, null, callback );
|
this._performSecureRequest( oauth_token, oauth_token_secret, method, url, null, callback );
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.OAuth.prototype.getOAuthRequestToken= function(callback) {
|
exports.OAuth.prototype.getOAuthRequestToken= function(extraParams, callback) {
|
||||||
var extraParams= {};
|
if( typeof extraParams == "function" ){
|
||||||
|
callback = extraParams;
|
||||||
|
extraParams = {};
|
||||||
|
}
|
||||||
|
|
||||||
// Callbacks are 1.0A related
|
// Callbacks are 1.0A related
|
||||||
if( this._authorize_callback ) {
|
if( this._authorize_callback ) {
|
||||||
extraParams["oauth_callback"]= this._authorize_callback;
|
extraParams["oauth_callback"]= this._authorize_callback;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user