{
  "id": 22300344,
  "title": "Firebase \"auth/unauthorized-domain\": the fix for Google sign-in that works on localhost but not in production",
  "url": "https://urgent.news/2026/11/28/firebase-auth-unauthorized-domain-the-fix-for-google-sign-in-that",
  "topic": "finance",
  "section": "Finance & Markets",
  "published": "2026-11-28T04:05:46.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/proofforge_live/firebase-authunauthorized-domain-the-fix-for-google-sign-in-that-works-on-localhost-but-not-in-2n3h"
  },
  "original_language": "en",
  "account": "Firebase sign-in errors persist from local testing to live production. The error message \"Firebase: Error (auth/unauthorized-domain)\" appears when clicking on the website, closing the popup or failing redirects. This issue affects only the live domain, not the localhost environment.\n\nFirebase Auth only permits OAuth sign-in from approved domains. The deployed domain is not on the approved list, causing Firebase to reject the request. New hosting domains, custom domains, www vs non-www entries, preview URLs, and wrong Firebase projects can all contribute to the problem.\n\nTo resolve this error, log in to the Firebase console, go to Authentication settings, and add the exact domain displayed in the failing page's browser address bar. Include both www and non-www variants if applicable. Ensure the authDomain and projectId in the deployed config match the corresponding project. Retry accessing the site in a private window.\n\nAvoid adding wildcard-like shortcuts or domains not under control, as this can create security vulnerabilities. Remove old preview domains no longer in use. Authorized domains control sign-in, but security rules determine data access. Check both to ensure proper protection. If rules still say \"allow read, write: if true, anyone can read and write.\" Free tools like proofforge.live can scan for open data, leaked keys, and exposed files. For checking specific user data access issues, a two-account test is available on the same website. Paid one-time fix reports start at $9.",
  "summary": "Google sign-in works on localhost, then you deploy and get: FirebaseError: Firebase: Error (auth/unauthorized-domain). The popup closes or the redirect fails, and only on your live domain. This one is quick to fix. The safe way matters, because the wrong shortcut opens the door to other sites. What it means Firebase Auth only allows OAuth sign-in (Google, GitHub, and so on) from domains you have…",
  "summary_source": "publisher",
  "key_points": [
    "\"Firebase auth/unauthorized-domain\" error occurs only on live domain, not localhost",
    "Add exact failing domain to Firebase console Authentication settings",
    "Include both www and non-www variants, match authDomain and projectId"
  ],
  "editors_take": "Strictly managing authorized domains prevents unauthorized OAuth sign-ins but requires developers to manually sync production URLs with Firebase settings to avoid breaking authentication during deployment.",
  "opinion": false,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "machine_translated": false,
  "ai_generated": true,
  "disclaimer": "Accounts, briefs, key points, the editor’s take and translations are written by software from other outlets’ reporting and may contain errors. A summary whose summary_source is \"publisher\" is the outlet’s own feed text. Always check the linked original."
}