Firebase authentication failing with auth/network-request-failed A network error (such as timeout

后端 未结 1 1215
情书的邮戳
情书的邮戳 2021-01-13 14:32

I have experienced very strange behaviour trying to do Firebase authnetication. Even more, I made a version that works and one that does not. First, the version that works:<

相关标签:
1条回答
  • 2021-01-13 14:38

    Resolved!

    I realized it has something with Content Security Policy, tried various options, and here is the solution. First, instead of inline

    onClick="loginToFirebase();"
    

    I had to register event listener

    function initApp(){
      document.getElementById('mybutton')
            .addEventListener('click', loginToFirebase);
    }
    
    window.onload = function() {
       initApp();
     }
    

    This was not the end of my problems, tried to specify Content Security Policy, but with no result.

    After very thoroughly looking at Firebase demo code, I decided to remove <form> tag and that was it!

    Hope, it will help someone :)

    0 讨论(0)
提交回复
热议问题