【问题标题】:Firebase connection errorFirebase 连接错误
【发布时间】:2017-05-24 19:01:03
【问题描述】:

我们使用 Firebase 和 React,通常效果很好。但在随机时间,Firebase 数据库将无法访问。我们也使用 firebase 进行身份验证,因此在这段时间内用户无法登录。

错误是

A network error (such as timeout, interrupted connection or unreachable host) has occurred.

这里是登录代码

signIn() {
    var provider = new firebase.auth.GoogleAuthProvider();
    provider.setCustomParameters({
         'prompt': 'select_account'
    });
    firebase.auth().signInWithPopup(provider).then(function(result) {
        // This gives you a Google Access Token. You can use it to access the Google API.
        var token = result.credential.accessToken;
        // The signed-in user info.
        var user = result.user;
    }.bind(this)).catch(function(error) {

        // Handle Errors here.
        var errorCode = error.code;
        var errorMessage = error.message;
        console.log(errorMessage);
        // The email of the user's account used.
        var email = error.email;
        // The firebase.auth.AuthCredential type that was used.
        var credential = error.credential;
        // ...
    });
}

有人知道是什么原因造成的吗?

【问题讨论】:

  • 您能否检查您的浏览器网络控制台以了解何时发生这种情况并包含相关日志?

标签: javascript firebase firebase-authentication


【解决方案1】:

这似乎与firebase的signInWithPopup功能有关。可能是您的浏览器在调用该功能时尝试打开新标签而不是弹出。您必须允许浏览器打开弹出窗口。此外,当出现此问题时,请重置浏览器的缓存并允许 3's party cookie,然后重试。最后,如果这些都不起作用,则问题源于浏览器的错误。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-05-21
    • 2018-02-13
    • 1970-01-01
    • 2017-11-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多