mirror of
https://github.com/hanzoai/node-jsonwebtoken.git
synced 2026-09-24 17:00:48 +00:00
clockTolerance for maxAge too
This commit is contained in:
@@ -283,7 +283,7 @@ JWT.verify = function(jwtString, secretOrPublicKey, options, callback) {
|
||||
if (typeof payload.iat !== 'number') {
|
||||
return done(new JsonWebTokenError('iat required when maxAge is specified'));
|
||||
}
|
||||
if (Date.now() - (payload.iat * 1000) > maxAge) {
|
||||
if (Date.now() - (payload.iat * 1000) > maxAge + (options.clockTolerance || 0)) {
|
||||
return done(new TokenExpiredError('maxAge exceeded', new Date(payload.iat * 1000 + maxAge)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user