Firebase error "auth/argument-error" when trying to sign in with Google/Facebook

Viewed 175

Below is the relevant code. The error auth/argument-error is thrown when the method signInWithPopup gets called:

import { AngularFireAuth } from "@angular/fire/compat/auth";
import firebase from "firebase/compat/app";
import "firebase/compat/auth";

constructor(
    private afAuth: AngularFireAuth,
  ) { }

async socialSignIn(providerName: "google" | "facebook") {
    const authProvider =
      providerName === "google"
        ? new firebase.auth.GoogleAuthProvider()
        : new firebase.auth.FacebookAuthProvider();
    return this.afAuth.signInWithPopup(authProvider);
  }

The relevant dependencies:

"firebase": "9.6.9",
"@angular/fire": "7.3.0",

And I'm using Angular 13. Any idea why this is happening? The error is not very useful.

2 Answers

Reverting to @angular/fire@7.2.1 has stopped this error from happening for me with Angular 13, firebase 9.8.1

it seems some references changed, you can import the class and instantiate instead of using firebase reference.

import { FacebookAuthProvider, GoogleAuthProvider } from '@angular/fire/auth';

new GoogleAuthProvider()
Related