-
-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Functions that call _removeSession
internally do not trigger SIGNED_OUT
event when the function fails
#853
Comments
Any update on this issue? |
@bombillazo hmm there shouldn't be a session return by |
We can call resend to change email or phone. I dont expect users to be signed out for this |
@bombillazo yeah we handle that case already by not removing the session if the type passed indicates an email change or phone change |
This issue is more related to what happens when something fails with the The PR I created fixes this: |
## What kind of change does this PR introduce? * Replaces #854 * Fixes #853, #904 * We don't need to remove the existing session prematurely. This causes some issues when users want to implement some sort of switch-account functionality since the existing session will always be removed regardless of whether the signup / sign-in attempt succeeds. * It's safe to remove `_removeSession` since calling `_saveSession` multiple times will just replace the existing session
This is still open and should be fixed with #854 |
## What kind of change does this PR introduce? This adds the SIGNED_OUT event missing in some logic that clears/logs out the session. ## What is the current behavior? #853
Bug report
Describe the bug
When using the client and auth functions, some internally call a
_removeSession
function, presumably to clear the session before attempting any auth-related logic. This effectively clears out the local session data used to keep the user logged in. In many cases the function runs and restores or resets the session data eventually. However, if the function fails, this does not trigger the SIGNED_OUT to notify any even handlers and hooks that the session data is no longer present, causing inconsistent auth data states.To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
auth-helpers-react
lib and use theuseSession
hook to get the session data.supabase.auth.resend
with invalid params to trigger an error and session remove.useSession
hook is not updated and retains the old values.Expected behavior
Any auth function that fails and deletes the auth session data should trigger a
SIGNED_OUT
event to notify any other serives.System information
The text was updated successfully, but these errors were encountered: