Firebase auth in SDK 9 does not work on ios sim or devices

I recently moved to the firebase v9 sdk for a brand new ionic/angular project. I was able to get the signInWithEmailAndPassword call to work in a web browser but it hangs in iphone simulators and devices. Strangely, it works in the ipad simulator. If I take the same app and switch it to the v8 firebase sdk, the login process works on all sims and devices.
I contacted Firebase tech support. I got the “It’s not us it’s ionic” response. Was not the kind of response I expected.
Any who, be aware that the firebase v9 sdk has problems when used with ionic.

1 Like

I am getting precisely the same error, (with signInWithEmailAndPassword, on an Ionic Angular project, on the IOS simulator). I will try and move back to Firebase v8.

There is an update on this. You can use the new v9 sdk if you want. You just need to initialize auth like so:

init() {
    const app = initializeApp(environment.firebase);
    if (Capacitor.isNativePlatform) {
      initializeAuth(app, {
        persistence: indexedDBLocalPersistence
      });
    }
    this.firestore = getFirestore(app);
  }

See this for more details: Auth does not work in ionic apps on iphone devices or sims · Issue #5552 · firebase/firebase-js-sdk · GitHub

If you want to use FB or Google auth, you need to look at this: Authenticate Using OAuth Providers with Cordova  |  Firebase

Thanks a lot for your answer. Do you know what that would look like in the app.module.ts file when using AngularFire? I can’t get it to work.

I don’t know. I would have to research it. If I get some time, I might get into it.

Regards,
Don Morris

Don you’re a legend - I’ve been struggling with this for 2 days. Thanks!

I didn’t solve it. This guy did jayordway (Jay Ordway) · GitHub

I saw that. But I wouldn’t have if you hadn’t posted here, so thanks anyway.