//creation of token
res.cookie('jwt', token, { httpOnly: true, maxAge : 60 * 60 * 24});
// the logout and where i want to destroy it
exports.logout = (req, res) => {
res.cookie('jwt', "token", {httpOnly:true,maxAge:1000})
// res.clearCookie('jwt');
}
it can’t be destroyed after the logout function
2
Answers
i tried this by changing the value and the expiration time :
You need to set an expiry date in the past, similar to this. Browsers will then discard the cookie and stop sending it. If applicable use the same cookie domain and path that you used when creating the cookie.