Skip to content

Commit

Permalink
Rename token check to _bearerTokenWillExpire
Browse files Browse the repository at this point in the history
Seems like a better name, since it returns true slightly before the token actually expires.
  • Loading branch information
eatyourgreens committed Mar 5, 2018
1 parent 1a2a80b commit 8bc2017
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/oauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 8bc2017

Please sign in to comment.