Error library

Firebase auth/unauthorized-domain

Firebase Auth rejects OAuth sign-in from domains that aren't in the project's authorized domains list. Add your custom domain (and preview domains you use) in Authentication settings.

Cause: The app's domain isn't in Firebase Auth's authorized domains.

How to fix it

  1. Open Firebase console > Authentication > Settings > Authorized domains.
  2. Add your production domain (e.g. app.example.com).
  3. Add any preview domains you test on.
  4. Update OAuth provider settings if you use a custom auth domain.

Example

Illustrative example, not from a customer project.

  Authorized domains
    localhost
    myapp.firebaseapp.com
+   app.example.com

FAQ

Why does it work on localhost?

localhost is authorized by default.

Do I need to redeploy?

No, the change is in Firebase settings.

Get a $149 diagnosis See pricing Still exposed or still logged out? Get an auth & database security fix (Supabase, Firebase).

$149Get a $149 diagnosis