Added an option to change the OAuth parameter seperator
This commit is contained in:
parent
a7c1e94e71
commit
5fab3c577e
@ -30,6 +30,7 @@ exports.OAuth= function(requestUrl, accessUrl, consumerKey, consumerSecret, vers
|
|||||||
"User-Agent" : "Node authentication"}
|
"User-Agent" : "Node authentication"}
|
||||||
this._clientOptions= this._defaultClientOptions= {"requestTokenHttpMethod": "POST",
|
this._clientOptions= this._defaultClientOptions= {"requestTokenHttpMethod": "POST",
|
||||||
"accessTokenHttpMethod": "POST"};
|
"accessTokenHttpMethod": "POST"};
|
||||||
|
this._oauthParameterSeperator = ",";
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.OAuthEcho= function(realm, verify_credentials, consumerKey, consumerSecret, version, signatureMethod, nonceSize, customHeaders) {
|
exports.OAuthEcho= function(realm, verify_credentials, consumerKey, consumerSecret, version, signatureMethod, nonceSize, customHeaders) {
|
||||||
@ -48,6 +49,7 @@ exports.OAuthEcho= function(realm, verify_credentials, consumerKey, consumerSecr
|
|||||||
this._headers= customHeaders || {"Accept" : "*/*",
|
this._headers= customHeaders || {"Accept" : "*/*",
|
||||||
"Connection" : "close",
|
"Connection" : "close",
|
||||||
"User-Agent" : "Node authentication"};
|
"User-Agent" : "Node authentication"};
|
||||||
|
this._oauthParameterSeperator = ",";
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.OAuthEcho.prototype = exports.OAuth.prototype;
|
exports.OAuthEcho.prototype = exports.OAuth.prototype;
|
||||||
@ -118,11 +120,11 @@ exports.OAuth.prototype._buildAuthorizationHeaders= function(orderedParameters)
|
|||||||
// 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( this._isParameterNameAnOAuthParameter(orderedParameters[i][0]) ) {
|
if( this._isParameterNameAnOAuthParameter(orderedParameters[i][0]) ) {
|
||||||
authHeader+= "" + this._encodeData(orderedParameters[i][0])+"=\""+ this._encodeData(orderedParameters[i][1])+"\",";
|
authHeader+= "" + this._encodeData(orderedParameters[i][0])+"=\""+ this._encodeData(orderedParameters[i][1])+"\""+ this._oauthParameterSeperator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
authHeader= authHeader.substring(0, authHeader.length-1);
|
authHeader= authHeader.substring(0, authHeader.length-this._oauthParameterSeperator.length);
|
||||||
return authHeader;
|
return authHeader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user