Skip to content

Conversation

@wangsijie
Copy link
Contributor

Summary

  • Use window.location.replace instead of window.location.assign when redirecting after sign-in callback
  • This prevents the code parameter URL from remaining in browser history, which would cause issues when users click the back button

Problem

When users sign in to account center:

  1. User visits /account (not authenticated)
  2. Redirected to sign-in page
  3. After sign-in, callback to /account?code=xxx
  4. Code is processed and user is redirected to /account

The issue was that window.location.assign adds a new entry to browser history, leaving /account?code=xxx in the history. When users click the back button, they return to this expired code URL and get stuck.

Solution

Using window.location.replace instead replaces the current history entry, so the code URL is not preserved in browser history.

Test plan

  • Sign in to account center
  • Verify successful redirect after callback
  • Click browser back button - should not return to code URL

Use window.location.replace instead of window.location.assign when
redirecting after sign-in callback. This prevents the code parameter
URL from remaining in browser history, which would cause issues when
users click the back button.
@github-actions github-actions bot added the bugfix label Jan 2, 2026
@github-actions
Copy link

github-actions bot commented Jan 2, 2026

COMPARE TO master

Total Size Diff 📈 +2 Bytes

Diff by File
Name Diff
packages/account/src/Callback.tsx 📈 +2 Bytes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants