# Can't login to my firebase backend base app on iOS but works on android

**URL:** <https://forum.ionicframework.com/t/cant-login-to-my-firebase-backend-base-app-on-ios-but-works-on-android/219216>\
**Category:** Ionic Framework\
**Created:** [January 8, 2022, 2:29pm UTC](https://forum.ionicframework.com/t/cant-login-to-my-firebase-backend-base-app-on-ios-but-works-on-android/219216 "2022-01-08T14:29:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![whit3](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/whit3/32/140469_2.png) [@whit3](https://forum.ionicframework.com/u/whit3)\
**Post date:** [January 8, 2022, 2:29pm UTC](https://forum.ionicframework.com/t/cant-login-to-my-firebase-backend-base-app-on-ios-but-works-on-android/219216/1 "2022-01-08T14:29:40Z")

</div>

I need help with my app on iOS.

I’ve completed building the app using firebase for the backend, while building I was testing it using only android device and emulator since I didn’t had a MacBook everything was good and working well, because of the fact that I need it on iOS too I bought MacBook pro 2012 recently and have installed all that is need to run the app and it’s runs on the emulator without errors but can’t l login on the emulator, if I try with a wrong password it returns an error meaning that it interacted with the db.

The app is working well on android

I really need help on this, thanks.

---

<div class="post-metadata">

**Author:** ![ciccilleju](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/ciccilleju/32/135142_2.png) [@ciccilleju](https://forum.ionicframework.com/u/ciccilleju)\
**Post date:** [January 8, 2022, 11:01pm UTC](https://forum.ionicframework.com/t/cant-login-to-my-firebase-backend-base-app-on-ios-but-works-on-android/219216/2 "2022-01-08T23:01:47Z")

</div>

can you please provide us logs, front end code etc?  
what is the http response?

---

<div class="post-metadata">

**Author:** ![whit3](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/whit3/32/140469_2.png) [@whit3](https://forum.ionicframework.com/u/whit3)\
**Post date:** [January 10, 2022, 1:52pm UTC](https://forum.ionicframework.com/t/cant-login-to-my-firebase-backend-base-app-on-ios-but-works-on-android/219216/3 "2022-01-10T13:52:35Z")

</div>

thanks for your response.

i just found out this and it help me solve the issue.

> [@Firebase auth in SDK 9 does not work on ios sim or devices](https://forum.ionicframework.com/t/firebase-auth-in-sdk-9-does-not-work-on-ios-sim-or-devices/215362):
>
> 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 t…

really appreciate your response.

---

<div class="post-metadata">

**Author:** ![whit3](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/whit3/32/140469_2.png) [@whit3](https://forum.ionicframework.com/u/whit3)\
**Post date:** [January 10, 2022, 2:06pm UTC](https://forum.ionicframework.com/t/cant-login-to-my-firebase-backend-base-app-on-ios-but-works-on-android/219216/4 "2022-01-10T14:06:25Z")

</div>

Here is the solution to the issue,  
I added this code in app.component and it is working in the iOS simulator. Here is the full file with imports:

```auto
import { Component } from '@angular/core';
import { Capacitor } from '@capacitor/core';
import { initializeApp } from 'firebase/app';
import { indexedDBLocalPersistence, initializeAuth } from 'firebase/auth';
import { environment } from 'src/environments/environment';

@Component({
  selector: 'app-root',
  templateUrl: 'app.component.html',
  styleUrls: ['app.component.scss'],
})
export class AppComponent {
  constructor() {
    const app = initializeApp(environment.firebase);
    if (Capacitor.isNativePlatform) {
      initializeAuth(app, {
        persistence: indexedDBLocalPersistence
      });
    }
  }
}

```

source: [Firebase auth in SDK 9 does not work on ios sim or devices - #8 by uncoded](https://forum.ionicframework.com/t/firebase-auth-in-sdk-9-does-not-work-on-ios-sim-or-devices/215362/8)

---

<div class="post-metadata">

**Author:** ![codemickey78](https://avatars.discourse-cdn.com/v4/letter/c/d9b06d/32.png) [@codemickey78](https://forum.ionicframework.com/u/codemickey78)\
**Post date:** [March 12, 2022, 10:38am UTC](https://forum.ionicframework.com/t/cant-login-to-my-firebase-backend-base-app-on-ios-but-works-on-android/219216/5 "2022-03-12T10:38:50Z")

</div>

I’m having same issue with my app. Can you please share your app.module.ts codes?
