Skip to content

Commit

Permalink
Add support for the PLAINTEXT signature method. Fixes #4.
Browse files Browse the repository at this point in the history
  • Loading branch information
ekoleda committed Jul 7, 2015
1 parent 8dd11d9 commit 2adf2e7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Service.gs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var Service_ = function(serviceName) {
this.method_ = 'get';
this.oauthVersion_ = '1.0a';
this.projectKey_ = eval('Script' + 'App').getProjectKey();
this.signatureMethod_ = 'HMAC-SHA1';
};

/**
Expand Down Expand Up @@ -95,6 +96,17 @@ Service_.prototype.setMethod = function(method) {
return this;
};

/**
* Sets the OAuth signature method to use. 'HMAC-SHA1' is the default.
* @param {string} signatureMethod The OAuth signature method. Allowed values
* are 'HMAC-SHA1' and 'PLAINTEXT'.
* @return {Service_} This service, for chaining.
*/
Service_.prototype.setSignatureMethod = function(signatureMethod) {
this.signatureMethod_ = signatureMethod;
return this;
};

/**
* Sets the specific OAuth version to use. The default is '1.0a'.
* @param {string} oauthVersion The OAuth version. Allowed values are '1.0a'
Expand Down Expand Up @@ -363,6 +375,7 @@ Service_.prototype.fetchInternal_ = function(url, params, opt_token,
var token = opt_token || null;
var oauthParams = opt_oauthParams || null;
var signer = new Signer({
signature_method: this.signatureMethod_,
consumer: {
public: this.consumerKey_,
secret: this.consumerSecret_
Expand Down

0 comments on commit 2adf2e7

Please sign in to comment.