According to documentation, https://github.com/auth0/node-jsonwebtoken#jwtverifytoken-secretorpublickey-options-callback, jwt.verify
will returns decode payload, I run the simple script:
var token = jwt.sign({email: req.body.email,}, 's3cr3t');
var decoded = jwt.verify(token, 's3cr3t');
console.log(decoded)
but it only output like: { iat: 1470725598 }
I expect the output should be like {email: [email protected],}
Is there something I am missing ?
email
MUST be a String, I've got the same issue because my key's value was an int and not a string (I just replaced{ key: value }
by{ key: `${value}` }
. – Naima