与 Firebase 通信时 Chrome 扩展身份验证/网络请求失败 [英] Chrome Extension auth/network-request-failed when communicating with Firebase

查看:22
本文介绍了与 Firebase 通信时 Chrome 扩展身份验证/网络请求失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实施 Firebase 电子邮件登录 进入我的扩展.从扩展 popup.html 中,我正在调用我的 login.html,它处理这个过程,它看起来像这样:

I'm trying to implement the Firebase E-Mail login into my Extension. From the extensions popup.html, I'm calling my login.html, which handles the process, it looks like this:

firebase.auth().signInWithEmailAndPassword(email, password).catch(function(error) {
          var errorCode = error.code;
          var errorMessage = error.message;
          if (errorCode === 'auth/wrong-password') {
            alert('Wrong password.');
          } else {
            console.error(error); //This produces the error quoted below
          }
        });

当我在本地打开我的 login.html 时,它可以工作.从扩展弹出窗口调用它使它不起作用,我收到错误:

When I just open my login.html locally, it works. Calling it from the extensions popup makes it not work, and I get the error:

身份验证/网络请求失败"

"auth/network-request-failed"

我假设 Chrome 阻止我的脚本与服务器通信.有解决方法吗?在文档中找不到任何解决方案.这不是我已经修复的内容安全策略.

I'm assuming Chrome prevents my script from communication with the server. Is there a workaround for this? Couldn't find any solution in the docs. It is not the content security policy which does that, that I already fixed.

---- 更新

在 Firebase 现在发布 3.0.5 之后,我现在收到一个不同的错误:

After Firebase now released 3.0.5, I'm getting a different error now:

身份验证/请求过多"

推荐答案

本周的下一个 js 版本 3.0.5 应该会修复这个问题.还要确保您可能已经配置了 manifest.json 文件,使用以下最低设置:

The fix for this issue should be out in the next js release 3.0.5 this week. Also make sure you have probably configured your manifest.json file, use the following minimum settings:

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

这篇关于与 Firebase 通信时 Chrome 扩展身份验证/网络请求失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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