Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/Service.gs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ Service_.prototype.handleCallback = function(callbackRequest) {
* @return {boolean} true if the user has access to the service, false otherwise.
*/
Service_.prototype.hasAccess = function() {
var token = this.getToken_();
var token = this.getToken();
if (!token || this.isExpired_(token)) {
if (token && token.refresh_token) {
try {
Expand Down Expand Up @@ -351,7 +351,7 @@ Service_.prototype.getAccessToken = function() {
if (!this.hasAccess()) {
throw 'Access not granted or expired.';
}
var token = this.getToken_();
var token = this.getToken();
return token.access_token;
};

Expand Down Expand Up @@ -447,7 +447,7 @@ Service_.prototype.refresh = function() {
'Client Secret': this.clientSecret_,
'Token URL': this.tokenUrl_
});
var token = this.getToken_();
var token = this.getToken();
if (!token.refresh_token) {
throw 'Offline access is required.';
}
Expand Down Expand Up @@ -500,9 +500,8 @@ Service_.prototype.saveToken_ = function(token) {
/**
* Gets the token from the service's property store or cache.
* @return {Object} The token, or null if no token was found.
* @private
*/
Service_.prototype.getToken_ = function() {
Service_.prototype.getToken = function() {
validate_({
'Property store': this.propertyStore_
});
Expand Down