add scope as an allowed oauth param so we can support google

This commit is contained in:
James Cooper 2010-10-30 11:57:44 -07:00
parent d53cb01282
commit bd54d3f899

View File

@ -202,7 +202,7 @@ exports.OAuth.prototype._performSecureRequest= function( oauth_token, oauth_toke
for( var i= 0 ; i < orderedParameters.length; i++) { for( var i= 0 ; i < orderedParameters.length; i++) {
// Whilst the all the parameters should be included within the signature, only the oauth_ arguments // Whilst the all the parameters should be included within the signature, only the oauth_ arguments
// should appear within the authorization header. // should appear within the authorization header.
if( orderedParameters[i][0].match('^oauth_') == "oauth_") { if( orderedParameters[i][0].match('^oauth_') == "oauth_" || orderedParameters[i][0] === 'scope') {
authHeader+= this._encodeData(orderedParameters[i][0])+"=\""+ this._encodeData(orderedParameters[i][1])+"\","; authHeader+= this._encodeData(orderedParameters[i][0])+"=\""+ this._encodeData(orderedParameters[i][1])+"\",";
} }
} }
@ -224,7 +224,7 @@ exports.OAuth.prototype._performSecureRequest= function( oauth_token, oauth_toke
if( !parsedUrl.pathname || parsedUrl.pathname == "" ) parsedUrl.pathname ="/"; if( !parsedUrl.pathname || parsedUrl.pathname == "" ) parsedUrl.pathname ="/";
if( parsedUrl.query ) path= parsedUrl.pathname + "?"+ parsedUrl.query ; if( parsedUrl.query ) path= parsedUrl.pathname + "?"+ parsedUrl.query ;
else path= parsedUrl.pathname; else path= parsedUrl.pathname;
var request = oauthProvider.request(method, path , headers); var request = oauthProvider.request(method, path , headers);
if( callback ) { if( callback ) {
var data=""; var data="";
@ -312,7 +312,7 @@ exports.OAuth.prototype.getOAuthRequestToken= function(extraParams, callback) {
// 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;
} }
this._performSecureRequest( null, null, "POST", this._requestUrl, extraParams, "", null, function(error, data, response) { this._performSecureRequest( null, null, "POST", this._requestUrl, extraParams, "", null, function(error, data, response) {
if( error ) callback(error); if( error ) callback(error);
else { else {