Skip to content

Commit 488d804

Browse files
author
Eric Koleda
authored
Merge pull request #79 from oshliaer/unprivate-service-gettoken
Unprivate Service.prototype.getToken_
2 parents 5385051 + 2c90b0f commit 488d804

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/Service.gs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ Service_.prototype.handleCallback = function(callbackRequest) {
318318
* @return {boolean} true if the user has access to the service, false otherwise.
319319
*/
320320
Service_.prototype.hasAccess = function() {
321-
var token = this.getToken_();
321+
var token = this.getToken();
322322
if (!token || this.isExpired_(token)) {
323323
if (token && token.refresh_token) {
324324
try {
@@ -351,7 +351,7 @@ Service_.prototype.getAccessToken = function() {
351351
if (!this.hasAccess()) {
352352
throw 'Access not granted or expired.';
353353
}
354-
var token = this.getToken_();
354+
var token = this.getToken();
355355
return token.access_token;
356356
};
357357

@@ -447,7 +447,7 @@ Service_.prototype.refresh = function() {
447447
'Client Secret': this.clientSecret_,
448448
'Token URL': this.tokenUrl_
449449
});
450-
var token = this.getToken_();
450+
var token = this.getToken();
451451
if (!token.refresh_token) {
452452
throw 'Offline access is required.';
453453
}
@@ -500,9 +500,8 @@ Service_.prototype.saveToken_ = function(token) {
500500
/**
501501
* Gets the token from the service's property store or cache.
502502
* @return {Object} The token, or null if no token was found.
503-
* @private
504503
*/
505-
Service_.prototype.getToken_ = function() {
504+
Service_.prototype.getToken = function() {
506505
validate_({
507506
'Property store': this.propertyStore_
508507
});

0 commit comments

Comments
 (0)