无法通过Google登录:用户身份验证/重定向已取消 [英] Unable to google login: auth/redirect-cancelled-by-user

查看:111
本文介绍了无法通过Google登录:用户身份验证/重定向已取消的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已遵循此处列出的所有步骤:

我想我肯定错过了一步,因为我根本无法使它正常工作.

解决方案

问题出在依赖项上.我更新到Cordova 8.0,然后开始出现构建错误.

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

code: "auth/redirect-cancelled-by-user", message: "The redirect operation has been cancelled by the user before finalizing."

  1. I have the correct config information in my app
  2. My firebase config matches my firebase's console's config.
  3. I have the correct dynamic link.
  4. I have installed all the required plugins
  5. SHA certificate fingerprints are added.
  6. Project has been given the name under google login settings in Firebase console.

Here is how I'm calling google login:

consturctor has public afAuth: AngularFireAuth. And couple relevant imports are:

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'll 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" />

I guess I must be missing a step because I can't get it to work at all.

解决方案

The problem was with dependencies. I updated to Cordova 8.0 and then I started to get build errors.

这篇关于无法通过Google登录:用户身份验证/重定向已取消的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆