Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.

Commit 2adf2e7

Browse files
author
ekoleda
committed
Add support for the PLAINTEXT signature method. Fixes #4.
1 parent 8dd11d9 commit 2adf2e7

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Service.gs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ var Service_ = function(serviceName) {
3030
this.method_ = 'get';
3131
this.oauthVersion_ = '1.0a';
3232
this.projectKey_ = eval('Script' + 'App').getProjectKey();
33+
this.signatureMethod_ = 'HMAC-SHA1';
3334
};
3435

3536
/**
@@ -95,6 +96,17 @@ Service_.prototype.setMethod = function(method) {
9596
return this;
9697
};
9798

99+
/**
100+
* Sets the OAuth signature method to use. 'HMAC-SHA1' is the default.
101+
* @param {string} signatureMethod The OAuth signature method. Allowed values
102+
* are 'HMAC-SHA1' and 'PLAINTEXT'.
103+
* @return {Service_} This service, for chaining.
104+
*/
105+
Service_.prototype.setSignatureMethod = function(signatureMethod) {
106+
this.signatureMethod_ = signatureMethod;
107+
return this;
108+
};
109+
98110
/**
99111
* Sets the specific OAuth version to use. The default is '1.0a'.
100112
* @param {string} oauthVersion The OAuth version. Allowed values are '1.0a'
@@ -363,6 +375,7 @@ Service_.prototype.fetchInternal_ = function(url, params, opt_token,
363375
var token = opt_token || null;
364376
var oauthParams = opt_oauthParams || null;
365377
var signer = new Signer({
378+
signature_method: this.signatureMethod_,
366379
consumer: {
367380
public: this.consumerKey_,
368381
secret: this.consumerSecret_

0 commit comments

Comments
 (0)