繁体   English   中英

Firebase Remote Config REST 授权错误

[英]Firebase Remote Config REST authorization error

我正在使用python 脚本将我的 firebase 远程配置数据作为 json 文件获取。 我的问题是,在设置服务帐户后,我仍然收到授权错误。 我的服务帐户的角色已设置为“Firebase Remote Config Admin”。 即使作为“所有者”,我仍然会收到授权错误。

{
  "error": {
    "code": 403,
    "message": "[AUTHORIZATION_ERROR]: User does not have the following permission: GET_TEMPLATE",
    "status": "PERMISSION_DENIED"
  }
}

关于通过授权检查什么的任何建议?

firebase 和 google 存储的服务帐户基本上是不同的。

如果您尝试使用普通服务帐户获取模板,您将失败

因此,您必须按照以下步骤生成 firebase 服务帐户

To generate a private key file for your service account:

In the Firebase console, open Settings > Service Accounts.

Click Generate New Private Key, then confirm by clicking Generate Key.

Securely store the JSON file containing the key.

可以在此链接中找到更多详细信息: https : //firebase.google.com/docs/remote-config/automate-rc#get_an_access_token_to_authenticate_and_authorize_api_requests

简而言之,要设置 firebase 服务帐户,请转到如下所示的网址(替换 your_project_name)

https://console.firebase.google.com/project/your_project_name/settings/serviceaccounts/adminsdk

希望这可以帮助某人。

我自己也遇到过这个问题,我的伏笔是:服务账户不是他们看起来的那样。 当您确定您的服务帐户具有正确的权限时,此 403 错误通常意味着您的代码没有使用您认为的帐户。 就我而言,即使在代码中指定要使用的凭据时,Firebase 仍在使用“App Engine 默认服务帐户”。 向 App Engine 默认服务帐户添加所需的权限为我解决了这个问题。 有关详细信息,请参阅: https://stackoverflow.com/a/71698105/2076025

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM