From 8bc2017290f177e01dcf4157b549b997c2fc5f8b Mon Sep 17 00:00:00 2001 From: Jim O'Donnell Date: Mon, 5 Mar 2018 16:21:39 +0000 Subject: [PATCH] Rename token check to _bearerTokenWillExpire Seems like a better name, since it returns true slightly before the token actually expires. --- lib/oauth.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/oauth.js b/lib/oauth.js index 2063273..8b2e586 100644 --- a/lib/oauth.js +++ b/lib/oauth.js @@ -31,7 +31,7 @@ module.exports = new Model({ checkBearerToken: function() { var awaitBearerToken; - if (this._bearerTokenIsExpired()) { + if (this._bearerTokenWillExpire()) { awaitBearerToken = this._refreshBearerToken(); } else { var tokenDetails = JSON.parse(SESSION_STORAGE.getItem(LOCAL_STORAGE_PREFIX + 'tokenDetails')); @@ -165,7 +165,7 @@ module.exports = new Model({ ].join(''); }, - _bearerTokenIsExpired: function() { + _bearerTokenWillExpire: function() { var tokenDetails = JSON.parse(SESSION_STORAGE.getItem(LOCAL_STORAGE_PREFIX + 'tokenDetails')); if (tokenDetails) { return Date.now() >= tokenDetails.expires_at - TOKEN_EXPIRATION_ALLOWANCE;