capacitor-firebase-auth
capacitor-firebase-auth copied to clipboard
Instance of firebase.auth.Auth must be passed as an argument
Hello, I'm trying to implement this plugin in a project but I'm facing an error I'm not able to fix. I've followed all the steps detailed in this repo (twice) and when I try to call the cfaSignIn method this shows in logcat:
2020-08-19 14:46:39.077 22933-23065/com.imascono.latorreoutlet E/Capacitor: JavaScript Error: {"type":"js.error","error":{"message":"Uncaught Error: Either an instance of firebase.auth.Auth must be passed as an argument to the firebase.auth.PhoneAuthProvider constructor, or the default firebase App instance must be initialized via firebase.initializeApp().","url":"http://localhost/static/js/2.ed6af05b.chunk.js","line":2,"col":1000021,"errorObject":"{\"code\":\"auth/argument-error\",\"message\":\"Either an instance of firebase.auth.Auth must be passed as an argument to the firebase.auth.PhoneAuthProvider constructor, or the default firebase App instance must be initialized via firebase.initializeApp().\"}"}}
2020-08-19 14:46:39.081 22933-22933/com.imascono.latorreoutlet E/Capacitor/Console: File: http://localhost/static/js/2.ed6af05b.chunk.js - Line 2 - Msg: Uncaught Error: Either an instance of firebase.auth.Auth must be passed as an argument to the firebase.auth.PhoneAuthProvider constructor, or the default firebase App instance must be initialized via firebase.initializeApp().
I'm not sure why it is trying to use the PhoneAuthProvider when I'm only using Google:
cfaSignIn("google.com").subscribe((user: User) =>
console.log(user.displayName)
);
This is my capacitor.config.json:
"CapacitorFirebaseAuth": {
"providers": ["google.com"],
"languageCode": "en",
"nativeAuth": false,
"permissions": {
"google": ["profile"]
}
}
Hi Grabiel,
Despite that you are seen this at logcat, maybe this is a Web Typer problem.
Did you initialize your firebase application? Please review the firebase documentation here
Hope this help you, looking forward to hearing from you.
Best regards, Bernardo Baumblatt
@gabriel-imascono I had the same issue until I implemented email & password sign in method using AngularFire. I suppose is because AngularFire needs Firebase initialization through AngularFireModule.initializeApp(firebaseConfig)