Nom*_*man 5 cordova firebase-authentication
我已按照此处列出的所有步骤操作: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."
Run Code Online (Sandbox Code Playgroud)
以下是我如何调用谷歌登录:
consturctor public 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);
});
}
}
Run Code Online (Sandbox Code Playgroud)
以上是我完整的方法.
下面是一个测试项目,所以我将显示所有设置:
<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" />
Run Code Online (Sandbox Code Playgroud)
我想我必须错过一步,因为我根本无法让它工作.
| 归档时间: |
|
| 查看次数: |
1070 次 |
| 最近记录: |