【发布时间】:2018-01-07 13:34:41
【问题描述】:
我正在开发一个 Ionic 3 应用程序,我在使用 firebase.auth().getRedirectResult() 函数时遇到了一个小问题。看起来它没有访问then 函数。我尝试控制台记录结果,但它没有出现在控制台中,string 的随机控制台日志也没有。我在那里做错了吗?
代码如下:
signInWithGoogle() {
const provider = new firebase.auth.GoogleAuthProvider();
return firebase.auth().signInWithRedirect(provider)
.then(() => {
firebase.auth().getRedirectResult()
.then(data => {
console.log(data); // Does not print this
console.log('User signed in.'); // Neither this
})
.catch(error => {
console.log(error);
throw (error);
});
})
.catch(error => {
console.log(error);
throw (error);
});
}
它在控制台中不记录任何内容,但它通过了身份验证。它成功登录帐户。
【问题讨论】:
-
您确定吗。您没有遇到任何错误吗?
-
@NakulKundaliya 如果有一个错误我真的看不到它,日志也是空的......
-
请注意,如果我使用弹出式登录方法,它会起作用。
标签: typescript firebase firebase-authentication ionic3 angularfire2