Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Login to firebase using gcloud service account

I have functions deployed to gcloud functions and i want to configure CI/CD for deploying this functions from gitlab. To do any operations from gitlab i need to get firebase auth token with

firebase login:ci

command.

The problem is that i need to get this token using gcloud service account, which is not displayed in browser, when i run

firebase login:ci

I have this service account data (project_id, private_key, private_key_id, etc.)

How should i authorize using this acc?

like image 835
Vitali Skripka Avatar asked Nov 26 '19 15:11

Vitali Skripka


People also ask

Where is service account in Firebase?

You can view all service accounts associated with your project in the Service accounts tab of your settings > Project Settings in the Firebase console.

How do you authenticate with a service account?

User accounts With a user account, you can authenticate to Google APIs and services in the following ways: Use the gcloud CLI to set up Application Default Credentials (ADC). Use the gcloud CLI to generate access tokens. Use your user credentials to impersonate a service account.


1 Answers

If you set an environment variable called GOOGLE_APPLICATION_CREDENTIALS as a path pointing to your service account JSON file, the Firebase CLI will automatically pick that up and use it to authorize commands. You don't need to be logged in or provide a --token argument when this is the case.

like image 98
Michael Bleigh Avatar answered Oct 19 '22 13:10

Michael Bleigh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!