2017-05-24 140 views
0

我们正在使用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; 
     // ... 
    }); 
} 

签署有谁知道代码什么可能导致这个?

+0

你可以检查你的浏览器网络控制台,当发生这种情况,并包括一个日志? – bojeil

回答

0

这似乎与firebase的signInWithPopup函数有关。当函数调用时,您的浏览器可能尝试打开新的选项卡,而不是弹出。您必须允许浏览器打开弹出窗口。此外,如果发生此问题,请重置浏览器缓存,并允许3的方cookies,然后再试一次。最后,如果这些不起作用,问题源于浏览器的错误。