Unable to logout user on react-native due to AuthSessionMissingError
Opened this issue · 1 comments
Bug report
- I confirm this is a bug with Supabase, not with my own application.
- I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
The quickstart guide for Supabase Auth for react-native uses getSession (as opposed to getUser).
If we have a user logged in at two locations A (next.js app) and B (react-native app), when the user logs out from location A with global scope and then tries to log out from location B, the logout returns an AuthSessionMissingError error, and the user is unable to log out ever since the sign out keeps failing but the session indicates a user existing.
If we switch the A and B in this scenario, it will work fine because next.js app recommends using getUser instead. It also works fine on using getUser in the mobile application as well. I've not yet tested with getClaims yet but I'd guess since that is a local check, it might result in similar problem.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
- Follow the official supabase documentation for next.js app (A) and react-native app (B)
- Login on A
- Login on B
- Sign out from A with global scope
- Sign out from B. The application will get stuck
Expected behavior
I think when an AuthSessionMissingError is received from the server, the library should probably just sign out the user.
If we switch the A and B in this scenario, it will work fine because next.js app recommends using getUser instead. It also works fine on using getUser in the mobile application as well.
Thank you for this workaround. Confirming it all works currently as you've said.
P.S. This all can be reproduced on web - doesn't have to be ios/android.