【发布时间】:2016-10-04 09:52:10
【问题描述】:
我正在使用带有 JsonWebtoken 模块的 NodeJ。
调用json web token的sign方法时遇到这个错误
ValidationError: "expiresInMinutes" 是不允许的
var jwt = require('jsonwebtoken');
exports.authenticate = function(req, res, next) {
var user = {"Name":"Abdul"} //static data for test purpose.
var token = jwt.sign(user, req.app.get('jwtTokenSecret'), {
expiresInMinutes: 1440 // expires in 24 hours
});
// return the information including token as JSON
res.json({
success: true,
message: 'Enjoy your token!',
token: token
});
}
【问题讨论】: