1

我打算为我的webapp使用Firebase的提供者身份验证,但似乎它在移动设备上无法使用。该网站是住在这里:Firebase Web身份验证在移动设备上无法使用?

https://cypher.city

然后当你点击这个按钮: enter image description here

弹出框将出现。当你点击这个按钮: enter image description here

然后它应该去谷歌提供商身份验证流程。

我代码,它看起来像这样:

var provider = new firebase.auth.GoogleAuthProvider(); 
    firebase.auth().signInWithRedirect(provider).then((result) => { 
    // console.log('@$ signin wiht google worked!' + e +', user is: ' + firebase.auth().currentUser.uid); 
    console.log('@$ signin wiht google worked!' + result.user); 

    }).catch((e) => { 
    console.log('@$ signin wiht google failed!' + e); 

    firebase.auth().signInAnonymously().then((user) => { 
     console.log('@$ signed in anonymously againQ ' + user.uid); 
     // console.log('@$ and firebase knows it: ' + firebase.auth().currentUser.uid); 
    }).catch((e) => { 
     console.log('@$ signed in anonymously failed ' + e); 

    }) 

    }) 

的问题是,虽然这个工程在桌面上伟大它根本不会在移动设备上运行。我尝试了“signInWithRedirect”和“signInWithPopup”,但是当我在我的华为荣誉手机上调用这些方法时,没有任何事情发生(在任何浏览器中)。

我在这里做错了什么或做了什么Firebase Web身份验证只是不适用于移动?

回答

4

这有点尴尬,但它可能会帮助别人。真正的问题事实上与移动设备没有任何关系,但实际上我使用的是自定义域名,并且忘记将其添加到控制台的身份验证部分。当我测试了Chrome浏览器开发工具制作的应用程序开放,我可以在控制台中看到此错误: enter image description here

添加我的自定义域的火力控制台的这部分工作: enter image description here

+2

你救了我很多痛苦小时。谢谢! – oortCloud

+1

哈哈,这里一样:) –