When using firebase.auth().signInWithPopup(googleAuthProvider);
, it works fine in the web app, but nothing happens in the iOS simulator using Ionic Capacitor. Do I need to use some kind of in app browser? Is there another way to sign in with google using Ionic Capacitor?
Assuming you are using the web SDK for Firebase? I believe you have to use the native SDKs. There is a plugin over here - Capacitor Firebase Authentication Plugin - Capawesome
I think this is getting closer to the right solution. It still works in the web using @capacitor-firebase/authentication, but now I’m getting a Thread 1: signal SIGABRT
app crash when trying in the iOS simulator , and I’m not sure how to debug it from here.
I backtracked and resolved the SIGABRT error. Here’s what I’ve done so far:
- yarn add
@capacitor-firebase/authentication
- Used this when signing in:
import { FirebaseAuthentication } from "@capacitor-firebase/authentication";
import { GoogleAuthProvider } from "firebase/auth";
...
const result = await FirebaseAuthentication.signInWithGoogle();
// 2. Sign in on the web layer using the id token
const credential = GoogleAuthProvider.credential(
result.credential?.idToken
);
firebase.auth().signInWithCredential(credential);
- Added an iOS app to my firebase console, downloaded the GoogleService-Info.plist file and put it in my ios/App/App folder (including adding it in xcode)
- Added
FirebaseApp.configure()
to the application method in the AppDelegate.swift file where FirebaseApp comes fromimport FirebaseCore
- Added this to my capacitor.config.ts file:
plugins: {
FirebaseAuthentication: {
skipNativeAuth: false,
providers: ["google.com"],
},
},
Yet when clicking the “Sign In With Google” button. Nothing happens, but I would expect a popup to appear to be able to log in with google.