How should the exp field of the payload be expressed ?
jwt.sign({
_id: this._id,
email: this.email,
name: this.name,
exp: //how do I set this value ?,
}, "MY_SECRET");
It's nowhere clearly explained in the docs
https://github.com/auth0/node-jsonwebtoken
From the example code I have here :
userSchema.methods.generateJwt = function() {
var expiry = new Date();
expiry.setDate(expiry.getDate() + 7);
return jwt.sign({
_id: this._id,
email: this.email,
name: this.name,
exp: parseInt(expiry.getTime() / 1000),
}, "MY_SECRET");
};
I assume "exp" expresses the expiration date of the Token, in seconds starting from epoch. Correct ?