2017-05-24 49 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,然後再試一次。最後,如果這些不起作用,問題源於瀏覽器的錯誤。