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

哈哈,這裏一樣:) –