Skip to content

Conversation

@7ttp
Copy link
Contributor

@7ttp 7ttp commented Jan 1, 2026

summary

removes the removeSession() call in initialize() when url based login fails, preserving valid sessions when users click a magic link more than once

problem

when a user clicks a magic link twice, the second click fails because the token is already consumed. the old code called removeSession() on this failure, which destroyed the valid session from the first click, logging the user out unexpectedly.

solution

don't call removeSession() on url login failure. a failed login attempt should never invalidate an existing valid session.

the original comment claimed this matchedverifyOtp, signUp, signInWith behavior, but none of those methods call removeSession() on error.

related

closes #1685

removes the _removeSession call on url login failure

which incorrectly destroyed valid sessions
@7ttp 7ttp requested review from a team as code owners January 1, 2026 08:43
@mandarini mandarini merged commit e801795 into supabase:master Jan 5, 2026
27 checks passed
@7ttp 7ttp deleted the fix/removesession branch January 5, 2026 16:29
@7ttp 7ttp restored the fix/removesession branch January 7, 2026 11:20
@7ttp 7ttp deleted the fix/removesession branch January 7, 2026 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clicking magic link twice logs user out via _removeSession

2 participants