Google SignIn Using Firebase In Capacitor Generating Error "auth/argumement-error"

  • Getting this error when trying to login. I have set the auth initialization as recommend.
  • Works fine in the browser
// initializing auth
if (Capacitor.isNativePlatform()) {
    auth = initializeAuth(app, {
        persistence: indexedDBLocalPersistence,
    });
} else {
    auth = getAuth(app);
}

Making the login call

export const fbGoogleSignIn = async () => {
    try {
        const provider = new GoogleAuthProvider();
        const result = await signInWithPopup(auth, provider);
        if (result) {
            const credential = GoogleAuthProvider.credentialFromResult(result)
            return {
                token: credential?.accessToken,
                user: result.user
            }
        }
    } catch (error) {
        console.error(error);
        // The AuthCredential type that was used.
        const credential = GoogleAuthProvider.credentialFromError(error as any);
        console.log("credential", credential);
        return {
            error,
            credential
        }
    }
}

hopefully the answer isn’t just use the plugin :frowning:

thanks in advance

1 Like

Hey, i just stumbled upon this issue myself when calling signInWithPopup trying to authenticate with Google. Did you ever find a solution? :slight_smile:

1 Like