I have a Firebase project that does not have billing enabled. I want to create database backups using a VM that belongs to another, billing-enabled project. The backup script is as simple as:
.npm/bin/firebase --project $PROJECT_ID database:get /
A freshly created Service Account is assigned to the VM running this script (through GCE). If this account doesn't have access to project $PROJECT_ID
, then obviously this fails:
Error: Authorization failed. This account is missing the following required permissions on project $PROJECT_ID:
firebase.projects.get
firebasedatabase.instances.get
But giving these specific permissions to the service account, or even assigning "Owner" role to that project doesn't make it much better. Instead:
Error: HTTP Error: 404, The specified project was not found.
Running with --debug
shows that specifically GET https://admin.firebase.com/v1/projects/$PROJECT_ID
returns 404.
The project exists, which I verify by running the exact same command with my own (non-service) account on my workstation. I have also verified that the account is the correct one by running gcloud auth list
on the VM. The project also shows up in the gcloud projects list
output on the same VM.
Is there a way to make the service account work cross-project and access Firebase Database?
Yes, You can use the same firebase database in more than one android application as below: In the Project Overview section of Firebase Console add an android application. For adding this application first you need to give that package name.
Run Below Command in your cli: firebase use --add
I saw this solution at : https://firebase.google.com/docs/hosting/?authuser=0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With