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
- Firebase console → Authentication → Settings → Authorized domains → Add domain.
- Add the exact host you're on (e.g.
yourapp.vercel.appand your custom domain). Preview deployments with random subdomains each need adding, or test on a stable domain. - If you use Google sign-in with a custom
authDomain, make sure the OAuth client's redirect URIs include it too.
Copy-paste fix prompt
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.