我正在使用python script以 json 文件形式获取我的 firebase 远程配置数据。 我的问题是,在我设置我的 service account 之后,我仍然收到授权错误。我的服务帐户的角色已设置为“Firebase 远程配置管理员”。即使作为“所有者”,我仍然收到授权错误。
{
"error": {
"code": 403,
"message": "[AUTHORIZATION_ERROR]: User does not have the following permission: GET_TEMPLATE",
"status": "PERMISSION_DENIED"
}
}
关于检查授权的内容有什么建议吗?
最佳答案
基本上,Firebase 和 Google Storage 的服务帐户是不同的。
如果您尝试使用普通服务帐户获取模板,您将会失败
因此您必须按照以下步骤生成 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
希望这对某人有帮助。
关于Firebase远程配置REST授权错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60162108/