問題描述
我正在嘗試將 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 一起使用的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!