Skip to content

Commit 08a8d9c

Browse files
author
Eric Koleda
committed
Release version 22
1 parent 488d804 commit 08a8d9c

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

dist/OAuth2.gs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ Service_.prototype.handleCallback = function(callbackRequest) {
392392
* @return {boolean} true if the user has access to the service, false otherwise.
393393
*/
394394
Service_.prototype.hasAccess = function() {
395-
var token = this.getToken_();
395+
var token = this.getToken();
396396
if (!token || this.isExpired_(token)) {
397397
if (token && token.refresh_token) {
398398
try {
@@ -425,7 +425,7 @@ Service_.prototype.getAccessToken = function() {
425425
if (!this.hasAccess()) {
426426
throw 'Access not granted or expired.';
427427
}
428-
var token = this.getToken_();
428+
var token = this.getToken();
429429
return token.access_token;
430430
};
431431

@@ -467,7 +467,7 @@ Service_.prototype.getRedirectUri = function() {
467467
Service_.prototype.getTokenFromResponse_ = function(response) {
468468
var token = this.parseToken_(response.getContentText());
469469
var resCode = response.getResponseCode();
470-
if ( !(resCode >= 200 && resCode < 300) || token.error) {
470+
if ( resCode < 200 || resCode >= 300 || token.error) {
471471
var reason = [
472472
token.error,
473473
token.message,
@@ -521,7 +521,7 @@ Service_.prototype.refresh = function() {
521521
'Client Secret': this.clientSecret_,
522522
'Token URL': this.tokenUrl_
523523
});
524-
var token = this.getToken_();
524+
var token = this.getToken();
525525
if (!token.refresh_token) {
526526
throw 'Offline access is required.';
527527
}
@@ -574,9 +574,8 @@ Service_.prototype.saveToken_ = function(token) {
574574
/**
575575
* Gets the token from the service's property store or cache.
576576
* @return {Object} The token, or null if no token was found.
577-
* @private
578577
*/
579-
Service_.prototype.getToken_ = function() {
578+
Service_.prototype.getToken = function() {
580579
validate_({
581580
'Property store': this.propertyStore_
582581
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "apps-script-oauth2",
3-
"version": "1.21.0",
3+
"version": "1.22.0",
44
"description": "OAuth2 for Apps Script is a library for Google Apps Script that provides the ability to create and authorize OAuth2 tokens as well as refresh them when they expire.",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)