AngularFireAuth signInWithEmailAndPassword callback is never thrown when deploying for iOS using Ionic Capacitor

Viewed 295

I built a webapp using Ionic 3, Angular 12, Firebase 9, AngularFire.

When I try to authenticate (on iOS) the callback is never thrown from this function and therefore the authentication is never performed although the requests are executed with a status code of 200. On the web the authentication works as intended.

import { AngularFireAuth } from "@angular/fire/compat/auth";
...
  async loginWithEmail(email: string, password: string) : Promise<void> {
    return new Promise<User>((resolve, reject) =>
      this.afAuth.signInWithEmailAndPassword(email, password).then(
        (res) => {
          resolve(res.user);
        },
        (error: { message: string }) => {
          reject(error);
          this.toastService.present({
            message: "Something has gone wrong. Please try again.",
            duration: 3000,
            color: "warning"
          });
          console.error(error.message);
        }
      )
    ).then(
      (result: User) => {
        if (result) {
          this._user.next(result);
        } else {
          if (result != null) {
            this.zone.run(() => {
              void this.router.navigate(['tabs', 'home']);
            });
          }
        }
      },
      (error: { message: string }) => {
        this.toastService.present({
          message: error.message,
          duration: 3000,
          color: "warning"
        });
      }
    );
  }

What can I do about this behaviour?

0 Answers
Related