Skip to content

fix: redirect issue when signing using different account#38

Merged
sirily11 merged 1 commit into
mainfrom
redirect
May 3, 2026
Merged

fix: redirect issue when signing using different account#38
sirily11 merged 1 commit into
mainfrom
redirect

Conversation

@sirily11
Copy link
Copy Markdown
Contributor

@sirily11 sirily11 commented May 3, 2026

No description provided.

Copilot AI review requested due to automatic review settings May 3, 2026 07:08
@vercel
Copy link
Copy Markdown

vercel Bot commented May 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
rxlab-auth Ready Ready Preview, Comment May 3, 2026 7:08am

Request Review

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an OAuth redirect bug when a signed-in user chooses “use a different account” (and when navigating from login → signup), ensuring OAuth authorize parameters are preserved correctly across redirects.

Changes:

  • URL-encode the nested OAuth authorize URL when redirecting to /login from account selection (“use different account”).
  • Preserve the redirect query param when navigating between /login and /register.
  • Add E2E coverage to prevent regressions for both “switch account” and “login → sign up → register” flows.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
e2e/oauth/account-select.spec.ts Adds E2E tests asserting OAuth params survive “use different account” and login→signup flows.
components/auth/register-form.tsx Preserves redirect when linking to login and (in E2E mode) redirects to redirect after successful registration.
components/auth/login-form.tsx Preserves redirect when linking to register from the login page.
actions/oauth/account-select.ts Fixes nested redirect construction by encoding the inner authorize URL as a single redirect param.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +12 to +16
authorizeParams.set("fresh_login", "true");
const loginParams = new URLSearchParams({
redirect: `/api/oauth/authorize?${authorizeParams.toString()}`,
});
redirect(`/login?${loginParams.toString()}`);
@sirily11 sirily11 merged commit 13563b7 into main May 3, 2026
7 checks passed
@sirily11 sirily11 deleted the redirect branch May 3, 2026 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants