首页 > 解决方案 > firebase.auth().signInWithEmailAndPassword 既不触发承诺也不捕捉错误

问题描述

我们正在使用 Firebase v4.12.0 和 Cordova。

firebase.auth().signInWithEmailAndPassword有时(经常)不会触发任何东西:既不是承诺也不是错误。它被卡住了。

当它按预期触发时,我们可以看到对 的请求googleapis.com,但是当它被卡住时,没有发出任何请求。

这似乎只在 iOS 上发生了几个星期。在过去的 5 年里没有发生过一次......

这是代码:

var config = {
   apiKey: "myapikey",
   authDomain: "myapp.firebaseapp.com",
   databaseURL: "https://myapp.firebaseio.com"
};
       
firebase.initializeApp(config);

firebase.auth().signInWithEmailAndPassword("email@domain.com", "password") 
    .then(function(firebaseUser) {
      if (firebaseUser) {
        console.log("logged !");
      } else {
        console.log("User is logged out");
      }
    })
    .catch(function(error) {
      if (error) {
        console.log("error : "+JSON.stringify(error));
      }
    });

这是一个已知的问题?如何调试并找到有关它的更多信息?

标签: javascriptfirebasefirebase-authentication

解决方案


推荐阅读