2

每当我在 Firebase 托管中部署网站时,首先我在 firebase 预览频道中运行它们,预览频道名称为alpha 部署到预览频道的命令是

firebase hosting:channel:deploy alpha

这样做的问题是,在我创建新频道时频道到期后,它会以以下形式创建一个新 URL

https://<project-id>--alpha-<random-hash>.web.app

其中随机哈希每次都不同。由于我的网站有 Google 登录并且我的项目出于安全原因将 HTTP 引荐来源设置为 Web API 密钥,因此每次我的 Google 标志停止工作并出现错误时都会创建新的预览 URL:

{"error":{"code":403,"message":"来自referer https://<project-id>--alpha-<random-hash>.web.app/ 的请求被阻止。","errors ":[{"message":"来自referer https://<project-id>--alpha-<random-hash>.web.app/ 的请求被阻止。","domain":"global","re​​ason ":"forbidden"}],"status":"PERMISSION_DENIED"}}

是否有一种通用方法可以在 Google API 控制台中为网站模式添加 HTTP 引荐来源网址,如下所示

https://<project-id>--alpha-*.web.app

现在添加它会在 Google API 控制台中出现错误

4

0 回答 0