Skip to content

Commit

Permalink
Fixed exp value when noTimestamp is required.
Browse files Browse the repository at this point in the history
santiagoaguiar authored and jfromaniello committed Mar 6, 2015

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
1 parent 91417dd commit 331b7bc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -24,14 +24,15 @@ module.exports.sign = function(payload, secretOrPrivateKey, options) {
header[k] = options.header[k];
});
}


var timestamp = Math.floor(Date.now() / 1000);
if (!options.noTimestamp) {
payload.iat = Math.floor(Date.now() / 1000);
payload.iat = timestamp;
}

if (options.expiresInMinutes) {
var ms = options.expiresInMinutes * 60;
payload.exp = payload.iat + ms;
payload.exp = timestamp + ms;
}

if (options.audience)

0 comments on commit 331b7bc

Please sign in to comment.