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
rp_st
11/24/2022, 5:13 PM
Hey @marcglassmanvee
rp_st
11/24/2022, 5:13 PM
Logout implies two things:
rp_st
11/24/2022, 5:13 PM
- clearing cookies which can only be done by the backend (since cookies are httpOnly)
rp_st
11/24/2022, 5:13 PM
- and clearing tokens in db, which again can only be done by the backend
rp_st
11/24/2022, 5:14 PM
So if the backend is down, neither of these can be done, hence session doesn’t get cleared
rp_st
11/24/2022, 5:15 PM
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
rp_st
11/24/2022, 5:15 PM
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
rp_st
11/24/2022, 5:15 PM
But I wouldn’t really recommend it, since it’s an odd flow in my opinion
SuperTokens is an open source authentication solution offering features like: Different types of login: Email / password, Passwordless (OTP or Magic link based).