Hey guys, I have had working code for the last year and a half and now all of my protected routes don’t work anymore with the token generated.
jet.verify() is returning undefined and when I try to copy my token into jwt.io, it now shows invalid signature. What am I doing wrong??
// Middleware to check token in header
const jwtVerify = (req, res) => {
jwt.verify(req.headers.token, process.env.PASSWORD, (err, _payload) => {
if (err) {
err.status = 401
err.message = `Unauthorized - You are not Chizette!`
return next(err);
} else {
req.payload = _payload
next()
}
})
}