Skip to content

Allow setting extra_params in signUrl #110

Closed
wants to merge 1 commit into from
+12 −4
View
16 lib/oauth.js
@@ -528,13 +528,17 @@ exports.OAuth.prototype.getOAuthRequestToken= function( extraParams, callback )
});
}
-exports.OAuth.prototype.signUrl= function(url, oauth_token, oauth_token_secret, method) {
+exports.OAuth.prototype.signUrl= function(url, oauth_token, oauth_token_secret, method, extra_params) {
if( method === undefined ) {
var method= "GET";
}
- var orderedParameters= this._prepareParameters(oauth_token, oauth_token_secret, method, url, {});
+ if( extra_params === undefined ) {
+ extra_params = {};
+ }
+
+ var orderedParameters= this._prepareParameters(oauth_token, oauth_token_secret, method, url, extra_params);
var parsedUrl= URL.parse( url, false );
var query="";
@@ -546,11 +550,15 @@ exports.OAuth.prototype.signUrl= function(url, oauth_token, oauth_token_secret,
return parsedUrl.protocol + "//"+ parsedUrl.host + parsedUrl.pathname + "?" + query;
};
-exports.OAuth.prototype.authHeader= function(url, oauth_token, oauth_token_secret, method) {
+exports.OAuth.prototype.authHeader= function(url, oauth_token, oauth_token_secret, method, extra_params) {
if( method === undefined ) {
var method= "GET";
}
- var orderedParameters= this._prepareParameters(oauth_token, oauth_token_secret, method, url, {});
+ if( extra_params === undefined ) {
+ extra_params = {};
+ }
+
+ var orderedParameters= this._prepareParameters(oauth_token, oauth_token_secret, method, url, extra_params);
return this._buildAuthorizationHeaders(orderedParameters);
};
Something went wrong with that request. Please try again.