Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution of Instance of firebase.auth.Auth must be passed as an argument #198

Open
jamalroger opened this issue Oct 31, 2021 · 0 comments
Open

Comments

@jamalroger
Copy link

Hi all The solution for who had this issues followed

Either an instance of firebase.auth.Auth must be p…must be initialized via firebase.initializeApp().

Problem :
the function cfaSignIn is called before firebase.initializeApp() that why these error is showed

Solution :
Is to add Promise before called cfaSignIn

Exemple

import firebase from "firebase/app";
import "firebase/auth";
const firebaseConfig = {
  apiKey: "AIzaSyDPSXEvut47Th-lGUCfzJ0GFP6npsjkVvs",
  authDomain: "bricolo-849a3.firebaseapp.com",
  projectId: "bricolo-849a3",
  storageBucket: "bricolo-849a3.appspot.com",
  messagingSenderId: "869830848668",
  appId: "1:869830848668:web:0916859b14b8f9168bfd59",
  measurementId: "G-6L2Z1P2FC3",
};

auth = () => {
  return new Promise((ex, reject) => {
    try {
      firebase.initializeApp(firebaseConfig);
      ex();
    } catch (error) {
      reject;
    }
  });
};

auth().then(() => {
  cfaSignInGoogle().subscribe((user) => console.log(user));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant