Firebase project results in error "Authorization / network failure" when logging in

I had a strange problem with my Cordova project that uses Firebase. It works fine in the browser, but when I run my application on an emulator or phone (Android), (at least), the first attempt to enter the download always leads to the error "Authentication / network failure". Here is my relevant Firebase code:

<!-- Import Firebase JS --> <script src="https://www.gstatic.com/firebasejs/3.2.1/firebase.js"></script> <!-- Import Firebase Authentication--> <script src="https://www.gstatic.com/firebasejs/ui/live/0.4/firebase-ui-auth.js"></script> <link type="text/css" rel="stylesheet" href="https://www.gstatic.com/firebasejs/ui/live/0.4/firebase-ui-auth.css" /> 

And here is my security meta tag (which, as I heard, can lead to a similar problem):

 <meta "content_security_policy": "script-src 'self' https://apis.google.com https://www.googleapis.com https://securetoken.googleapis.com; object-src 'self'", "permissions": ["https://*/*","activeTab"]> 

EDIT: I did not change the code, but now I sometimes experience this error in the browser (Chrome), if less. I cannot find the template, although the problem seems to disappear in the session after user registration. Any help would be greatly appreciated, thank you very much.

+7
source share
5 answers

I came up with this answer using Firebase support. It turns out that my button calling the login function was of type โ€œsubmitโ€, which caused my page to refresh every time it was clicked. This will interrupt the authentication process, resulting in a "network failure" error. To fix this, get rid of type = "submit" in the button.

+17
source

I spent a lot of time on this, and only when I turned off the CORS Chrome extension when it started working in Chrome.

Chrome Canary and Firefox without the CORS extension were good too. I do not think the type of sending matters.

+4
source

Disable the CORS Chrome plugin for me

0
source

Finally, I fixed this problem!

  • Do not use the form tag! I changed the form tag to a div tag, then it works !!!
  • Do not use input type="submit" , as someone is responding there.

So far, I'm not quite sure why. But what are the two places that I changed, and then finally fixed a problem with the Firebase network.

0
source

According to [CORS ORIGIN POLICY] 1 chrome will not allow you to access any other sites without (http, https). The solution will be resolved after the placement of your website, for temporary testing you can use Mozilla Firefox , which allows you to access. Have a nice day!!

0
source

All Articles