Skip to content

fix(auth): make social login use one redirect navigation - #180

Merged
iamjr15 merged 1 commit into
mainfrom
fix/auth-google-redirect
Aug 8, 2026
Merged

fix(auth): make social login use one redirect navigation#180
iamjr15 merged 1 commit into
mainfrom
fix/auth-google-redirect

Conversation

@iamjr15

@iamjr15 iamjr15 commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replace forced popup OAuth for sign-in and sign-up with Clerk's full-page redirect flow.
  • Prevent a remotely chunked popup callback from crashing the signed-out Next.js tree during session replacement.
  • Restore strict Cross-Origin-Opener-Policy: same-origin now that authentication does not need an opener relationship.

Root cause

Production Google OAuth reached Clerk and created the session, but the popup callback intermittently failed while loading a remote @clerk/ui chunk. The popup then had to reconcile the newly authenticated identity into the already-rendered anonymous application tree, producing the generic client-side exception page.

Architecture

OAuth now performs one authoritative navigation:

Cheatcode sign-in -> Google -> Clerk callback -> requested Cheatcode path

The installed @clerk/ui version remains pinned through ClerkProvider; only the transport changes.

Decisions made

Decision Choice Alternative Reasoning
OAuth transport Full-page redirect Forced popup Removes popup lifecycle, opener, and cross-window identity reconciliation failure modes.
Opener policy same-origin same-origin-allow-popups Redirect auth no longer requires cross-origin opener access, so production isolation can be strict.
Clerk UI version Keep pinned Remove ui={ui} Version pinning is Clerk's documented deterministic-rendering path.

Verification

  • pnpm lint
  • pnpm typecheck
  • pnpm turbo build --force
  • pnpm deadcode
  • pnpm architecture:check
  • pnpm turbo skills:build
  • Reproduced production Google sign-in with the requested Google account and captured the failing Clerk UI chunk before the change.
  • Post-deploy acceptance: repeat sign-out -> Google account selection -> Clerk callback -> authenticated Cheatcode route, then inspect console and network errors.

Scope

No database, migration, environment, API, or worker topology changes.

Replace fragile popup callbacks with one full-page Clerk navigation and restore
same-origin opener isolation. This prevents remote popup renderer failures from
crashing the signed-out application tree.
@iamjr15
iamjr15 merged commit 13c7c9a into main Aug 8, 2026
4 checks passed
@iamjr15
iamjr15 deleted the fix/auth-google-redirect branch August 8, 2026 07:00
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