与电子一起使用Firebase [英] Using Firebase with Electron

查看:108
本文介绍了与电子一起使用Firebase的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

 未捕获错误:此域未授权用于您的Firebase项目的OAuth操作。从Firebase控制台编辑授权域列表。 

我无法将一个空的(或通配符)授权网域添加到Firebase控制台,所以我因此卡住了。有没有人有任何想法,如何解决这个问题?

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

p>

 < script src =https://www.gstatic.com/firebasejs/live/3.0/firebase.js> < /脚本> 
< 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 sign inWithPopup / signInWithRedirect操作需要authDomain,但其他所有操作都应该有效。



仅当您实际尝试执行signInWithPopup时引发该错误的库版本/ Redirect正在开发中。


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.

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>

解决方案

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.

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

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

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