我已按照此处列出的所有步骤操作:
https://firebase.google.com/docs/auth/web/cordova,验证了所有信息,但我仍然收到以下错误.
https://firebase.google.com/docs/auth/web/cordova,验证了所有信息,但我仍然收到以下错误.
code: "auth/redirect-cancelled-by-user",message: "The redirect operation has been cancelled by the user before finalizing."
>我的应用程序中有正确的配置信息
>我的firebase配置与我的firebase的控制台配置相匹配.
>我有正确的动态链接.
>我已经安装了所有必需的插件
>添加SHA证书指纹.
>项目已在Firebase控制台中的google登录设置下获得名称.
以下是我如何调用谷歌登录:
consturctor有公共afAuth:AngularFireAuth.夫妻相关进口产品是:
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); }); } }
以上是我完整的方法.
下面是一个测试项目,所以我将显示所有设置:
<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" />
我想我必须错过一步,因为我根本无法让它工作.
解决方法
问题在于依赖性.我更新到Cordova 8.0然后我开始出现构建错误.