Hi. I'm running locally using a react FE and expre...
# support-questions
m
Hi. I'm running locally using a react FE and express BE, and When my backend is down, and I logout, is does not log me out. Is this the expected behavior? I would expect the cookies to be cleaned and logout to succeed ...
Copy code
import Session from "supertokens-web-js/recipe/session";
await Session.signOut();
r
Hey @marcglassmanvee
Logout implies two things:
- clearing cookies which can only be done by the backend (since cookies are httpOnly)
- and clearing tokens in db, which again can only be done by the backend
So if the backend is down, neither of these can be done, hence session doesn’t get cleared
What you could do is to override the sign out function on the frontend and catch the error thrown by the original implementation (in case backend is down) and save some localstorage state signifying that this happened
Then on each page navigation, you could check if that state is set and if it is, show a popup to the user telling them that they will be logged out, and then call the signOut function again
But I wouldn’t really recommend it, since it’s an odd flow in my opinion
2 Views