将 Firebase 与 Electron 一起使用

Using Firebase with Electron(将 Firebase 与 Electron 一起使用)
本文介绍了将 Firebase 与 Electron 一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我正在尝试将 Firebase 与 Electron 一起使用.当像我在网页上一样安装它时,它不起作用,因为 Electron 页面托管在本地并且没有 hostname.这是我遇到的错误...

I'm trying to use Firebase with Electron. When installing it just like I would on a web page it doesn't work because Electron pages are hosted locally and don't have a hostname. This is the error I'm getting...

Uncaught Error: This domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console.

我无法将空(或通配符)授权域添加到 Firebase 控制台,因此我被卡住了.有没有人知道如何解决这个问题?

I can't add an empty (or wildcard) authorized domain to the Firebase console so I'm therefore stuck. Does anybody have any ideas of how to work around this?

这是我正在使用的代码,它只是标准样板,没有额外的......

edit: Here's the code I'm using, it's just the standard boilerplate, nothing extra...

<script src="https://www.gstatic.com/firebasejs/live/3.0/firebase.js"></script>
<script>
  var config = {
    apiKey: "AIzaSyBvmmPB0_Oddc-02cUj3Ntt3wi8jSxxxx",
    authDomain: "xxxxx-d24ad.firebaseapp.com",
    databaseURL: "https://xxxxx-d24ad.firebaseio.com",
    storageBucket: "",
  };
  firebase.initializeApp(config);
</script>

推荐答案

现在,您可以通过从配置中删除 authDomain 行来抑制此错误.Auth signInWithPopup/signInWithRedirect 操作需要 authDomain,但其他一切都应该工作.

For now, you can suppress this error by removing the authDomain line from your config. authDomain is needed for the Auth signInWithPopup/signInWithRedirect operations, but everything else should work.

只有在您实际尝试执行 signInWithPopup/Redirect 时才会引发该错误的库版本正在开发中.

A version of the library that throws that error only when you actually try to do a signInWithPopup/Redirect is in the works.

这篇关于将 Firebase 与 Electron 一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

opening html from google drive(从谷歌驱动器打开 html)
Google apps script get range of bytes from binary file(谷歌应用程序脚本从二进制文件中获取字节范围)
Sending Multiple attachments with Google Script from Google Drive(使用 Google 脚本从 Google Drive 发送多个附件)
Distributing Google Apps Scripts for Sheets in your company network(在您的公司网络中分发适用于表格的 Google Apps 脚本)
Upload file to my google drive from anyone using javascript(使用 javascript 将文件从任何人上传到我的谷歌驱动器)
quot;Shared Drivequot; support in Google Apps Script(“共享驱动器Google Apps 脚本中的支持)