Google login failed: auth / redirect-cancel-by-user

I followed all the steps listed here: https://firebase.google.com/docs/auth/web/cordova , checked all the information, but I still get the error below.

code: "auth/redirect-cancelled-by-user", message: "The redirect operation has been cancelled by the user before finalizing."
  • I have the correct configuration information in my application.
  • My firebase configuration matches my firebase console configuration.
  • I have the correct dynamic link.
  • I installed all the necessary plugins
  • SHA certificate fingerprints are added.
  • The project got a name under google login parameters in the Firebase console.

This is how I call google:

consturctor has public afAuth: AngularFireAuth. And a couple of relevant imports:

import * as firebase from 'firebase/app';
import { AngularFireAuth } from 'angularfire2/auth';

// signInWithGoogle.
  signInWithGoogle(): void {
    this.showLoading();
    if (this.platform.is('android')) {
      console.log("android");
      this.provider = new firebase.auth.GoogleAuthProvider();
      this.afAuth.auth.signInWithRedirect(this.provider)
        .then(function () {
          return firebase.auth().getRedirectResult();
        })
        .then((result: any) => {
          if (result) {
            this.handleUser(result);
          }
        })
        .catch((error: any) => {
          this.hideLoading();
          var errorMessage = error.message;
          console.log("android login error: ", error);
        });
    }
    if (this.platform.is('core')) {
      console.log("in core");
      this.provider = new firebase.auth.GoogleAuthProvider();
      this.afAuth.auth.signInWithPopup(this.provider)
        .then((result: any) => {
          if (result) {
            this.handleUser(result);
          }
        })
        .catch((error: any) => {
          this.hideLoading();
          var errorMessage = error.message;
          console.log("error: ", error);
        });
    }
  }

Above is my complete method.

Below is a test project, so I will show all the settings:

<universal-links>
    <host name="bhb7m.app.goo.gl" scheme="https" />
    <host name="test1-2366d.firebaseapp.com" scheme="https">
        <path url="/__/auth/callback" />
    </host>
</universal-links>
<preference name="AndroidLaunchMode" value="singleTask" />

Dynamic link Android settings

Webapp configuration Android Menifest

, - , .

+4
1

. 8.0, .

+2

Source: https://habr.com/ru/post/1691568/


All Articles