Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const createToken = (authtype, payload) => {
var date = new Date();
var expires = moment()
.add(5, "minutes")
.valueOf();
var claims = {
iss: "appseed",
sub: payload.subject,
name: payload.name,
auth: payload.auth,
exp: expires,
iat: date
};
return jwt.encode(claims, SECRET); // add token to the req (to be passed on to the get/route)
};