fix(web): allow /google/callback through auth middleware (Google login bounce) #4070
ccantynzcommented Jun 11, 2026
Originally written by @vercel[bot] on GitHub.
Deployment failed with the following error:
There is no GitHub account connected to this Vercel account.ccantynzcommented Jun 11, 2026
Originally written by @vercel[bot] on GitHub.
The latest updates on your projects. Learn more about Vercel for GitHub.
| Project | Deployment | Actions | Updated (UTC) |
|---|---|---|---|
| alec-rae-com-admin | Preview, Comment | Jun 11, 2026 10:43am |
Cross-repo impact
See what breaks downstream if this PR merges.
⮌ Merged
This pull request was merged into main.
c comment · e edit title · m merge · a approve · r request changes · ? shortcuts
Originally written by @ccantynz-alt on GitHub.
Imported from https://github.com/ccantynz-alt/AlecRae.com/pull/61
The bug
Google sign-in completes (consent + callback both work) but the user lands back on
/loginunauthenticated.Root cause (confirmed in code — not a cookie-domain issue)
Our Google flow hands the session token to the web app via the URL fragment (
apps/api/src/routes/auth.ts:381-388→ redirects tomail.alecrae.com/google/callback#token=…). The callback page's client JS reads the fragment and stores the session (completeGoogleSignIn→localStorage["alecrae_api_key"]+alecrae_sessioncookie).But the Next.js SSR middleware (
apps/web/middleware.ts) guards every non-public path by checking thealecrae_sessioncookie — and/google/callbackwas not inPUBLIC_PATHS. So the server-side guard ran before any client JS, saw no cookie (the token is in the fragment, invisible to the server), and redirected to/login. The token was never stored.Password login works because it sets the cookie on
/login(already public) before navigating.This is not the cross-subdomain cookie theory (
Domain=.alecrae.com; SameSite=None): API auth is a Bearer token from localStorage (CORS); thealecrae_sessioncookie is only the web app's own SSR guard onmail.alecrae.com.Fix
Add
/google/callbacktoPUBLIC_PATHSso the page's client code runs, persists the session, and routes to/inbox.How to confirm after deploy
DevTools → Network → sign in with Google → the
/google/callbackrequest should now render the page (was previously 307→/login), then land on/inboxauthenticated.https://claude.ai/code/session_01McgJLnTbZG9mwhfwd5iAX3
Generated by Claude Code