我正在尝试将 Firebase 与 Electron 一起使用。当我像在网页上一样安装它时,它不起作用,因为 Electron 页面在本地托管并且没有 hostname
。这是我得到的错误…
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 控制台,因此我被卡住了。有人对如何解决这个问题有任何想法吗?
编辑:这是我正在使用的代码,它只是标准样板,没有额外的……
<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>
原文由 DaveJ 发布,翻译遵循 CC BY-SA 4.0 许可协议
现在,您可以通过从配置中删除 authDomain 行来抑制此错误。 Auth signInWithPopup/signInWithRedirect 操作需要 authDomain,但其他一切都应该有效。
仅当您实际尝试执行 signInWithPopup/Redirect 时才会抛出该错误的库版本正在开发中。