I am trying to login to the Firebase Tools CLI with a GCP service account. I have the path to the service account credentials saved as GOOGLE_APPLICATION_CREDENTIALS
. I have logged out of firebase with firebase logout
and have tried to sign in with the service account with firebase login --no-localhost
and firebase login --no-localhost --token $GOOGLE_APPLICATION_CREDENTIALS
. However in bother cases a web browser opens asking me to log in with my user account. How can I log in to firebase with a service account?
2 Answers
Taken from Michael Bleighs comment:
"The Firebase CLI does support GOOGLE_APPLICATION_CREDENTIALS
, but you don't need to "log in" with them. If the environment variable is pointing to a valid service account you should be able to just use CLI commands as if you are logged in. You do need to be logged out for GAC to work correctly. Run the command with --debug if you're getting errors while trying to do so."
I can confirm I have this working. Note you might need to run firebase use <project-id>
for it to work correctly.
You can't sign in to your Firebase project with a service account. You will need to use the proper user account of a collaborator on the project to sign in with Firebase tools.
Even when using the CI integration, the documentation says to:
Start the signin process by running the following command:
firebase login:ci
Visit the URL provided, then sign in using a Google account.