Skip to content

Commit

Permalink
fix: issue correct expiry dates for tokens (#2)
Browse files Browse the repository at this point in the history
related to a NodeJS (nodejs/node#7074) and furthermore
V8 bug (https://bugs.chromium.org/p/v8/issues/detail?id=3637); replaced
seconds calculation with milliseconds.
  • Loading branch information
razvanz authored Sep 25, 2017
1 parent b304698 commit c919691
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions lib/grant-types/abstract-grant-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,15 @@ AbstractGrantType.prototype.generateRefreshToken = function(client, user, scope)
*/

AbstractGrantType.prototype.getAccessTokenExpiresAt = function() {
var expires = new Date();

expires.setSeconds(expires.getSeconds() + this.accessTokenLifetime);

return expires;
return new Date(Date.now() + this.accessTokenLifetime * 1000);
};

/**
* Get refresh token expiration date.
*/

AbstractGrantType.prototype.getRefreshTokenExpiresAt = function() {
var expires = new Date();

expires.setSeconds(expires.getSeconds() + this.refreshTokenLifetime);

return expires;
return new Date(Date.now() + this.refreshTokenLifetime * 1000);
};

/**
Expand Down

0 comments on commit c919691

Please sign in to comment.