Skip to content

fix(auth): keep the return path when Google refuses an unverified email - #15

Merged
hjescalona merged 1 commit into
smgfrom
feat/google-account-linking
Nov 9, 2026
Merged

hjescalona merged 1 commit into
smgfrom
feat/google-account-linking

Conversation

@hjescalona

Copy link
Copy Markdown

Brings the review fix from CapSoftware#3964 into smg.

When Google refuses a sign-in because the email isn't verified, /login?error=GoogleEmailUnverified now carries the safe return path from the next-auth.callback-url cookie as next, so the email-code fallback (and a mobile handoff) finishes the original flow instead of landing on /dashboard. Off-origin paths are dropped.

Tests: two new cases in sso-auth-route.test.ts; auth suites pass (140).

The signIn callback can't see the request, so /login?error=GoogleEmailUnverified
dropped the destination kept in the callback-url cookie. The email-code
fallback then landed on /dashboard, and a mobile sign-in never handed off
its session. The NextAuth route now adds the cookie's safe return path as
next on that redirect, the same way SSO errors keep theirs.

Also drops a test comment that only restated the code.
@hjescalona
hjescalona merged commit 4d489e5 into smg Nov 9, 2026
6 checks passed
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