Chris Esplin
Chris Esplin

Reputation: 892

Firebase Authentication: auth/auth-domain-config-required

I'm getting auth-domain-config-required errors when using firebase.auth().signInWithPopup(provider).

I've tried with Google and Facebook. I've tested on my hosted site, and it works fine. You can test it live: Quiver Chat Demo

I suspect there's a problem with localhost:3333... does it not like my port? I can't add a port to the Authorized domains list, and adding it to my authDomain: config doesn't help either.

Here's my auth code, but as you can see from the screenshots below, I tried a bunch of different authDomain values.

  <script src="https://quiver-four.firebaseapp.com/__/firebase/4.6.2/firebase-app.js"></script>
  <script src="https://quiver-four.firebaseapp.com/__/firebase/4.6.2/firebase-auth.js"></script>
  <script>
    // Initialize Firebase
    var config = {
      apiKey: "AIzaSyCzNxnQ6WCJKejq6SBd7NqhVskxEOmDq_Y",
      authDomain: "quiver-four.firebaseapp.com",
      databaseURL: "https://quiver-four.firebaseio.com",
      projectId: "quiver-four",
      storageBucket: "quiver-four.appspot.com",
      messagingSenderId: "1082528354495"
    };
    firebase.initializeApp(config);
  </script>

Attempting localhost:3333

Attempting localhost:3333


Attempting localhost

Just localhost


Attempting quiver-four.firebaseapp.com

quiver-four.firebaseapp.com, as copied from the Firebase console


The domains are added

enter image description here

Upvotes: 4

Views: 7205

Answers (2)

I had the same problem and my solution was to have a file in the root firebase.js with all the connection configuration:

// Import the functions you need from the SDKs you need
import { initializeApp } from "firebase/app";
import { getFirestore } from "firebase/firestore";
import {getAuth} from 'firebase/auth'

import { getAnalytics } from "firebase/analytics";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries

// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
  apiKey: "xxxxxxx_xxx_R-xxx-CDxxxxcg",
  authDomain: "qxxxxxx-xxxx.firebaseapp.com",
  projectId: "xxxxxx-xxxxx",
  storageBucket: "xxxxxxx-xxxx.appspot.com",
  messagingSenderId: "xxxxxxx",
  appId: "1:xxxxxxx:wxb:xxxxxxxxxxxxxx",
  measurementId: "G-xxxxx"
};

// Initialize Firebase
const app = initializeApp(firebaseConfig);
const analytics = getAnalytics(app);

export const db = getFirestore(app);
export const auth = getAuth(app);

Upvotes: 2

bojeil
bojeil

Reputation: 30798

You must not be providing the correct authDomain in your Firebase app initialization configuration. You can get that web snippet from the Firebase Console. The authDomain has the form projectName.firebaseapp.com.

Upvotes: 3

Related Questions