I have an express API with the following code in order to set a cookie:
...
res.setHeader("Access-Control-Allow-Origin", ip);
res.cookie(name, token, { maxAge: 30000, httpOnly: true, secure: false, sameSite: "Lax" });
...
And this other to clear the cookie:
...
res.clearCookie(name);
...
When I execute the second one, I got the following error message: Cookie “cookieName” will be soon rejected because it has the “sameSite” attribute set to “none” or an invalid value on clearCookie
Some details:
- The error shows up only in Firefox, not in Chrome.
- Before setting sameSite: "Lax", I received the error message twice, after setting the cookie as well as when clearing it. After setting sameSite to Lax, the problem only appeared when clearing the cookie.
Any help? Let me know if you need more details, versions, code...