尝试设置示例 Web 应用程序时出现 Firebase OAuth 错误

Firebase OAuth error when trying to set up sample web application

我在网络浏览器中收到以下错误消息

firebase.js:75 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 web app sample 下载到我的本地计算机,将 Firebase 控制台中的代码片段粘贴到 "database" 示例项目的 .html 文件中并启用 Google 作为控制台中的身份验证方法。

删除代码段会删除错误,但它根本不起作用(不出所料)。

还尝试了 "auth" 示例项目。

我注意到 Firebase 有一个 service disruption reported,但不确定是否是这个原因。

我做错了什么?

要在您的计算机(本地)上进行开发,您需要 运行 来自本地 http 服务器的项目 - 而不仅仅是来自文件。即 url 需要类似于 http://localhost... 而不是 file://.....

然后您需要在 auth > signin methods > OAuth redirect domains

下将 "localhost" 添加到 firebase 控制台