Fix guides / Firebase: auth/unauthorized-domain

Fixing Firebase "auth/unauthorized-domain" when you sign in on your live site

Sign in with Google works on localhost. On your deployed site the popup closes and the console shows FirebaseError: Firebase: Error (auth/unauthorized-domain). Firebase only allows sign-in from domains you list.

The fix (2 minutes)

  1. Open the Firebase Console and select your project.
  2. Go to Authentication, then Settings, then Authorized domains.
  3. Click Add domain and enter your live domain only, without https:// or a path. For example myapp.com, www.myapp.com, or myapp.vercel.app.
  4. Refresh your site and try again.

localhost and your Firebase hosting domains are on the list by default, which is why it worked during development.

Preview deployments

Each Vercel or Netlify preview URL is a different domain, and the list does not accept wildcards. Either test sign-in on your production domain, or add the specific preview domains you use regularly.

Still failing?

  • Wrong Firebase project. Check that the authDomain and projectId in your deployed config match the project you edited. Apps often have separate dev and prod projects, and the deploy may use the other one.
  • Env vars missing in production. If the config comes from environment variables, confirm they are set on your host (with the VITE_ or NEXT_PUBLIC_ prefix) and that you redeployed.
  • Popup blocked. Some browsers block popups not started by a click. Call signInWithPopup directly inside the click handler.
  • Custom domain for the auth handler. If you changed authDomain to your own domain, the Google Cloud OAuth client must list https://YOUR-DOMAIN/__/auth/handler as an authorized redirect URI.
Still stuck? No shame in it: these bugs hide in settings your AI builder cannot see. Send us the error and your repo and we will fix it as a pull request within 24 hours, explained in plain English, for $49. Not fixed means full refund.
Request a fix

Last updated 2026-10-19.