Skip to content

fix: use real browser navigation for login and logout in SSR mode - #7

Merged
yogeshchoudhary147 merged 2 commits into
mainfrom
fix/ssr-navigation
Aug 18, 2026
Merged

fix: use real browser navigation for login and logout in SSR mode#7
yogeshchoudhary147 merged 2 commits into
mainfrom
fix/ssr-navigation

Conversation

@yogeshchoudhary147

Copy link
Copy Markdown
Contributor

Problem

loginWithRedirect used React Router's navigate() (client-side fetch) and logout used useSubmit. Both fail for auth routes because:

  • /auth/login returns a 302 redirect to Auth0 — client-side fetch doesn't follow external redirects
  • Both handlers set Set-Cookie headers that client-side fetch ignores
  • logout requires a POST — useSubmit makes a fetch-based submission that doesn't follow Auth0's logout redirect

Fix

  • loginWithRedirect now uses window.location.href to force a real browser request
  • logout now creates and submits a native <form> element so the browser follows the redirect and processes cookies correctly
  • Removed unused useSubmit import

@Piyush-85 Piyush-85 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yogeshchoudhary147
yogeshchoudhary147 merged commit 3e940d7 into main Aug 18, 2026
4 checks passed
@yogeshchoudhary147
yogeshchoudhary147 deleted the fix/ssr-navigation branch August 18, 2026 03:23
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.

2 participants