Firebase项目结果“认证/网络请求失败”登录错误 [英] Firebase Project Results in "Auth/network-request-failed" error on login

查看:1507
本文介绍了Firebase项目结果“认证/网络请求失败”登录错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个奇怪的问题,我的Cordova项目使用Firebase。它在浏览器中工作得很好,但是当我在模拟器或手机(Android)上运行我的应用程序时,(至少)每次加载的第一次登录尝试总是导致Auth / network-request-failed错误。这里是我相关的Firebase代码:

I'm running into a strange problem with my Cordova Project that uses Firebase. It works perfectly in browser, but when I run my app on an emulator or phone (Android), (at least) the first login attempt per load always results in an "Auth/network-request-failed" error. 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" />

这里是我的安全元标记(我听说可能会导致类似的问题) / p>

And here is my security meta-tag (which I heard could result in 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"]>

编辑:我没有更改任何代码,但现在我偶尔在浏览器好,如果不太频繁。我找不到一个模式,虽然问题似乎在用户注册后的会话中消失。任何帮助将非常感谢,非常感谢你。

I have not changed any code but now I experience this error occasionally in browser (Chrome) as well, if less often. I can't find a pattern, although the issue seems to go away in a session after the user registers. Any help would be greatly appreciated, thank you so much.

推荐答案

我得到了这个答案与Firebase支持的帮助。事实证明,我的按钮是调用登录功能的类型提交,这导致我的页面每次被按下时刷新。这将中断认证过程,导致网络请求失败错误。要解决这个问题,请在按钮中删除type =submit。

I arrived at this answer with the help of Firebase support. It turns out that my button which was calling the login function was of type "submit," which was causing my page to refresh every time it was pressed. This would interrupt the authentication process, resulting in the "network-request-failed" error. To fix this get rid of type="submit" in the button.

这篇关于Firebase项目结果“认证/网络请求失败”登录错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆