Im trying to add a logout functionality to my mern app where I only have google authentication using passportJS. I want to clear the cache and cookies on logout because if I don't it automatically logs me back in without asking for what account to choose.
The cookie im trying to delete is a https only cookie
I have tried what seems like every solution on the internet but none of them work
logout
document.cookie = "connect.sid=; Max-Age=0;secure;path=/"; // This worked only for the first time
// clears cache which works fine
caches.keys().then((names) => {
names.forEach((name) => {
caches.delete(name);
});
});
window.open(`${apiURL}/auth/logout`, "_self");
I have tried other solutions like: react-cookie, universal-cookie, js-cookie etc... But none of them seem to work either.
Does anyone know how to do this I have been stuck on this for a long time?