Skip to content

Firebase Authentication errorFirebase: Error (auth/unauthorized-domain)

Firebase refused sign-in because the page’s domain isn’t on the project’s list of authorized domains. It usually appears on a new custom domain or a preview URL. Here’s the fix, or hand it over at a fixed price.

Short answer

The domain your app runs on isn’t in Firebase’s Authorized domains list. In the Firebase console, go to Authentication, then Settings, then Authorized domains, and add the exact domain, such as app.example.com, without https:// or a path. Every preview URL counts as its own domain, and projects created after April 28, 2025 no longer include localhost.

The usual causes, and the fix

  1. 01

    A new custom domain

    You moved the app from a hosting subdomain to your own domain, and the new domain was never added. Add it, and the www version if your site uses it.

  2. 02

    Preview and branch deploy URLs

    Netlify and Vercel give each preview its own address, and each address is a separate domain to Firebase. Add the preview domains you test sign-in on, or test sign-in on one fixed staging domain that is on the list.

  3. 03

    localhost is missing

    “In projects created after April 28, 2025, Firebase Authentication no longer includes localhost as an authorized domain by default.” Firebase docs, Authentication FAQ and troubleshooting

    Add localhost in the development project if you sign in locally. Google advises keeping it out of the production project. 127.0.0.1 is a different domain from localhost, so open the app on the one you added.

  4. 04

    Redirect sign-in on a custom domain

    If you use signInWithRedirect and your app is on its own domain, Firebase’s redirect guide says to set that domain as authDomain and add https://your-domain/__/auth/handler as a redirect URI at the sign-in provider. Add the domain to Authorized domains too. The guide also lists switching to signInWithPopup.

Checked against the vendor’s docs on : Firebase docs: Authentication FAQ and troubleshooting; Firebase docs: Best practices for using signInWithRedirect.

Rather hand it over?

Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.

Related: Supabase auth emails link to localhost · Free Firebase rules checker

Questions

More on this error

Do I have to add every preview URL?

Only the ones you sign in on. It’s simpler to test sign-in on one fixed staging domain that’s on the list, and use previews for everything else.

Should localhost stay on the list in production?

Google advises removing it from production projects, so that code running on someone else’s computer can’t sign in to your production project. Keep it in a separate development project.

The error is auth/unauthorized-continue-uri instead. Is that the same?

Close. That one is about the link inside an email, such as a password reset or email sign-in link: the continue URL’s domain must be on the same Authorized domains list.

Can you fix it for me?

If one bug is the whole problem, the App Fix Ticket covers it: a written diagnosis first, then the fix. If the app has more going on, the Launch Check is a written check of the whole app. Each issue found is rated critical, high, medium or low, with where it is and how it was confirmed. No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way.

A different error?

Describe it and get a written quote

Send the error and what you were doing. You get a written scope, a fixed price and a timeline; we reply by email, usually within one business day.