jwt.verify(token,process.env.SECRETKEY, function(err,decodedToken){
console.log(decodedToken);
})
Console output
{ email: '[email protected]', iat: 1601341321 }
how can I read the value of email from decoded token?
jwt.verify(token,process.env.SECRETKEY, function(err,decodedToken){
console.log(decodedToken);
})
Console output
{ email: '[email protected]', iat: 1601341321 }
how can I read the value of email from decoded token?
Attach the email to the request, then you can access that value from the controller
You can use that value later on the controller using req.user or creating a decorator (I prefer this).