Skip to content

Commit 6ee8575

Browse files
author
Eric Koleda
committed
Revert "Expose the ability to manually refresh tokens, for APIs that provide refresh_tokens but don't set an expiry time (SalesForce for instance). Fixes googleworkspace#10."
This reverts commit 2c20b21.
1 parent 2c20b21 commit 6ee8575

File tree

1 file changed

+5
-23
lines changed

1 file changed

+5
-23
lines changed

Service.gs

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ var Service_ = function(serviceName) {
2828
this.serviceName_ = serviceName;
2929
this.params_ = {};
3030
this.tokenFormat_ = TOKEN_FORMAT.JSON;
31-
this.stateParameterLocation_ = STATE_PARAMETER_LOCATION.AUTHORIZATION_URL;
3231
};
3332

3433
/**
@@ -70,18 +69,6 @@ Service_.prototype.setTokenFormat = function(tokenFormat) {
7069
return this;
7170
};
7271

73-
/**
74-
* Sets the location of the state parameter, which is required by the
75-
* /usercallback endpoint.
76-
* Default: OAuth2.STATE_PARAMETER_LOCATION.AUTHORIZATION_URL.
77-
* @param {STATE_PARAMETER_LOCATION} tokenFormat The format of the returned token.
78-
* @return {Service_} This service, for chaining.
79-
*/
80-
Service_.prototype.setStateParameterLocation = function(stateParameterLocation) {
81-
this.stateParameterLocation_ = stateParameterLocation
82-
return this;
83-
};
84-
8572
/**
8673
* Sets the project key of the script that contains the authorization callback function (required).
8774
* The project key can be found in the Script Editor UI under "File > Project properties".
@@ -207,16 +194,10 @@ Service_.prototype.getAuthorizationUrl = function() {
207194
.createToken();
208195
var params = {
209196
client_id: this.clientId_,
210-
response_type: 'code'
197+
response_type: 'code',
198+
redirect_uri: redirectUri,
199+
state: state
211200
};
212-
if (this.stateParameterLocation_ == STATE_PARAMETER_LOCATION.AUTHORIZATION_URL) {
213-
params['state'] = state;
214-
} else {
215-
redirectUri = buildUrl_(redirectUri, {
216-
state: state
217-
});
218-
}
219-
params['redirect_uri'] = redirectUri;
220201
params = _.extend(params, this.params_);
221202
return buildUrl_(this.authorizationBaseUrl_, params);
222203
};
@@ -346,8 +327,9 @@ Service_.prototype.parseToken_ = function(content) {
346327
/**
347328
* Refreshes a token that has expired. This is only possible if offline access was
348329
* requested when the token was authorized.
330+
* @private
349331
*/
350-
Service_.prototype.refresh = function() {
332+
Service_.prototype.refresh_ = function() {
351333
validate_({
352334
'Client ID': this.clientId_,
353335
'Client Secret': this.clientSecret_,

0 commit comments

Comments
 (0)