clockTolerance for maxAge too

This commit is contained in:
Jacopo
2016-03-25 00:35:58 +01:00
parent 80a499fb3d
commit 26e91cb17f
+1 -1
View File
@@ -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)));
}
}