Firebase Error -auth Auth-domain-config-required- -

const firebaseConfig = apiKey: "your-api-key", authDomain: "your-app.firebaseapp.com", // ← THIS IS CRITICAL // For custom domains: "signin.yourdomain.com" projectId: "your-project-id", // ... ;

While not best practice, some developers try to bypass this by manually initializing Firebase without domain verification. Disabling security features in production exposes your users to serious OAuth redirect vulnerabilities.

In the Firebase Console, go to Authentication > Settings > Authorized Domains. Ensure your domain (e.g., localhost or your production URL) is listed there.

You might be using a generic config or an environment variable that isn't loading. Firebase Error -auth Auth-domain-config-required-

Exclude the path /__/auth/ from your service worker's caching or intercepting logic. Summary Checklist

Pro Tip: Automate this via the Firebase CLI. Use firebase functions:config:set or environment variables in your CI/CD pipeline to whitelist domains programmatically.

OAuth 2.0 protocols rely heavily on redirect URIs. When a user clicks "Sign in with Google," Google sends a token back to your app via a redirect. If a malicious site tries to imitate your domain, they could steal that token. In the Firebase Console, go to Authentication >

Ensure your initialization looks like the "Correct" version below, specifically checking that authDomain is present and correctly mapped to your project ID (usually ://firebaseapp.com Correct Implementation: javascript firebaseConfig = { apiKey: "YOUR_API_KEY" , authDomain: "YOUR_PROJECT_://firebaseapp.com" // This is the "proper piece" projectId: "YOUR_PROJECT_ID" , storageBucket: "YOUR_PROJECT_://appspot.com" , messagingSenderId: "YOUR_SENDER_ID" , appId: "YOUR_APP_ID" // Initialize Firebase firebase.initializeApp(firebaseConfig); Use code with caution. Copied to clipboard Stack Overflow Common Causes Manual Entry Errors : If you are populating your config from variables (like a

file or a backend template), verify that the variable names match exactly and that authDomain

If the error persists even with the correct config, check these settings: Exclude the path /__/auth/ from your service worker's

const firebaseConfig = apiKey: "AIza...", authDomain: "your-project-id.firebaseapp.com", // This line is likely missing or wrong projectId: "your-project-id", // ... other fields ; Use code with caution. Copied to clipboard 2. Verify Authorized Domains

Even with the correct config, if you are developing on a specific domain (like a production URL or a custom dev tunnel), it must be whitelisted: