Yesterday, I found myself in a cookie conundrum with two cookies called access_token and refresh_token.
I was struggling to figure out how to delete both of these cookies at once:
const logout = (req, res) => {
res.clearCookie('access_token', { path: '/' });
res.clearCookie('refresh_token', { path: '/' });
return res.status(200).json({
EM: "logout success",
EC: 1,
DT: "",
});
}
However, I discovered that when I only had one cookie, I could still manage to clear it using the clearCookie() method.
Now, my aim is to find a way to effectively delete all cookies in just one action.
If anyone has any suggestions or solutions, please share! Thank you.