FirebaseAuthDeploy

Firebase Auth: auth/unauthorized-domain

Firebase: Error (auth/unauthorized-domain).

In short: Your deployed domain isn't in Firebase Authentication's authorized domains list.

Why it happens

Firebase only allows OAuth sign-in (Google, GitHub, etc.) from domains you list. localhost is allowed by default, so it works locally and breaks on your new Vercel, Netlify, Replit, or custom domain.

How to fix it

  1. Firebase console → Authentication → Settings → Authorized domains → Add domain.
  2. Add the exact host you're on (e.g. yourapp.vercel.app and your custom domain). Preview deployments with random subdomains each need adding, or test on a stable domain.
  3. If you use Google sign-in with a custom authDomain, make sure the OAuth client's redirect URIs include it too.
Don't: Don't switch to a different auth provider over this. It's a one-line settings change.

Copy-paste fix prompt

Paste into Cursor, Claude Code, Codex, Lovable, Bolt, Replit or v0
I'm getting this error in my app:

Firebase: Error (auth/unauthorized-domain).

[Paste the full error, stack trace, and the file it points to here]

Likely cause: Your deployed domain isn't in Firebase Authentication's authorized domains list.

Task: List every domain this app is served from (local, preview, production, custom) so I can add them to Firebase authorized domains, and check my firebaseConfig authDomain is correct.

Rules:
- First explain the root cause in 2 sentences and list the files you'll change.
- Make the smallest change that fixes it. Don't refactor unrelated code.
- Don't disable security or checks (RLS, auth, signature verification, type checking, CORS allow-all) to make the error disappear.
- Never print or hard-code secret keys.
- Finish by telling me exactly how to verify the fix.

Common with: Cursor, Bolt, Replit, Lovable. Last reviewed 2026-11-13.

Related fixes

← All fixes · Still stuck? Use the diagnose-first prompt