简体   繁体   中英

Firebase Remote Config REST authorization error

I am using a python script to get my firebase remote config data as a json file. My problem is that after I setup my service account , I still get the authorization error. My service account's role is already set to "Firebase Remote Config Admin". Even as "Owner", I still get the authorization error.

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

Any suggestions on what to check get through authorization?

Basically service accounts for firebase and google storage are different.

If you try to get template using normal service account you will fail

So you have to generate a firebase service account by following the below steps

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.

More details can be found in this link: https://firebase.google.com/docs/remote-config/automate-rc#get_an_access_token_to_authenticate_and_authorize_api_requests

In short, to setup the firebase service account go to an url like below (replace your_project_name)

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

Hope this helps someone.

I've encountered this issue myself and my foreshadowing is: the service accounts are not what they seem. This 403 error when you are sure your service account has the correct permissions generally means your code is not using the account you think it is. In my case, even when specifying the credentials to use in the code, Firebase was still using the 'App Engine default service account'. Adding the required permissions to the App Engine default service account resolved this issue for me. For more information see: https://stackoverflow.com/a/71698105/2076025

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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