最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Firebase Authentication: authauth-domain-config-required - Stack Overflow

programmeradmin4浏览0评论

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=".6.2/firebase-app.js"></script>
  <script src=".6.2/firebase-auth.js"></script>
  <script>
    // Initialize Firebase
    var config = {
      apiKey: "AIzaSyCzNxnQ6WCJKejq6SBd7NqhVskxEOmDq_Y",
      authDomain: "quiver-four.firebaseapp",
      databaseURL: "",
      projectId: "quiver-four",
      storageBucket: "quiver-four.appspot",
      messagingSenderId: "1082528354495"
    };
    firebase.initializeApp(config);
  </script>

Attempting localhost:3333


Attempting localhost


Attempting quiver-four.firebaseapp


The domains are added

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

Attempting localhost:3333


Attempting localhost


Attempting quiver-four.firebaseapp.


The domains are added

Share Improve this question edited Nov 19, 2017 at 4:37 Chris Esplin asked Nov 17, 2017 at 15:14 Chris EsplinChris Esplin 8929 silver badges16 bronze badges 3
  • 1 Hey Chris. Can you edit your question to include the code of how you initialize the Firebase app? My first guess is that something's going wrong there. – Frank van Puffelen Commented Nov 17, 2017 at 16:11
  • Hey Frank, I tried three varieties and copied them all up. – Chris Esplin Commented Nov 19, 2017 at 4:38
  • Have you been able so solve this? Facing a similar issue. – Stefan Falk Commented Apr 19, 2023 at 10:23
Add a ment  | 

2 Answers 2

Reset to default 3

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..

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./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.",
  projectId: "xxxxxx-xxxxx",
  storageBucket: "xxxxxxx-xxxx.appspot.",
  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);
发布评论

评论列表(0)

  1. 暂无评论