Skip to content

fix: use localStorage for Stytch return URL#559

Open
paulvanbrenk wants to merge 1 commit intomainfrom
fix/stytch-redirect-url
Open

fix: use localStorage for Stytch return URL#559
paulvanbrenk wants to merge 1 commit intomainfrom
fix/stytch-redirect-url

Conversation

@paulvanbrenk
Copy link
Collaborator

Summary

  • Stop appending returnUrl as a query param to Stytch redirect URLs — Stytch requires exact URL matches including query params, which breaks OAuth login
  • Store return URL in localStorage before initiating auth, read it back in /authenticate
  • Falls back to query param for backwards compat with any in-flight magic links

Trade-off

If a user opens a magic link on a different device, they'll land on / instead of the original page. This is acceptable — cross-device return URL preservation would require server-side state.

🤖 Generated with Claude Code

Stytch requires exact match on redirect URLs including query params,
which breaks OAuth login when returnUrl is appended. Store the return
URL in localStorage instead and read it back after authentication.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant