Google sign-in fails: auth handler is cross-site under Chrome storage partitioning #2

Open
opened 2026-08-19 22:06:53 -04:00 by logan · 0 comments
Owner

Symptom: the Google sign-in popup opens, flashes, closes. The page shows "Google sign-in failed. Try again." Nothing appears in the browser console or the network tab.

Cause: the app is served from drb.cusano.net, but signInWithPopup opens its handler on discord-radio-bot-461301.firebaseapp.com. Chrome partitions third-party storage, so the popup cannot read back the state its opener wrote. Visiting the handler directly confirms it: "missing initial state ... a storage-partitioned browser environment".

Nothing was wrong with authorised domains or the build. The shipped bundle carries the correct apiKey and authDomain, which is exactly what made this look like a code bug.

Fix — all three parts are required or nothing changes:

  1. Caddy proxies /__/auth/* to the Firebase Hosting origin. DONE in the Caddyfile template, but needs an ansible-playbook run to deploy (CI does not deploy templates).
  2. CI secret FIREBASE_AUTH_DOMAIN must become drb.cusano.net, then the frontend rebuilt.
  3. drb.cusano.net must be listed in the Firebase console's authorised domains.

Parts 2 and 3 are outstanding.

Separately, app/login/page.tsx swallowed the Firebase error entirely (} catch {), which is why nothing showed in the console and why this took so long to identify. That has been fixed.

**Symptom:** the Google sign-in popup opens, flashes, closes. The page shows "Google sign-in failed. Try again." Nothing appears in the browser console or the network tab. **Cause:** the app is served from `drb.cusano.net`, but `signInWithPopup` opens its handler on `discord-radio-bot-461301.firebaseapp.com`. Chrome partitions third-party storage, so the popup cannot read back the state its opener wrote. Visiting the handler directly confirms it: *"missing initial state ... a storage-partitioned browser environment"*. Nothing was wrong with authorised domains or the build. The shipped bundle carries the correct `apiKey` and `authDomain`, which is exactly what made this look like a code bug. **Fix — all three parts are required or nothing changes:** 1. Caddy proxies `/__/auth/*` to the Firebase Hosting origin. DONE in the Caddyfile template, but needs an `ansible-playbook` run to deploy (CI does not deploy templates). 2. CI secret `FIREBASE_AUTH_DOMAIN` must become `drb.cusano.net`, then the frontend rebuilt. 3. `drb.cusano.net` must be listed in the Firebase console's authorised domains. Parts 2 and 3 are outstanding. Separately, `app/login/page.tsx` swallowed the Firebase error entirely (`} catch {`), which is why nothing showed in the console and why this took so long to identify. That has been fixed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: logan/server-26#2