使用gcloud服务帐户登录Firebase [英] Login to firebase using gcloud service account
问题描述
我已将功能部署到gcloud功能,并且我想配置CI/CD以从gitlab部署此功能. 要从gitlab进行任何操作,我需要使用
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
命令.
问题是我需要使用gcloud服务帐户获取此令牌,当我运行
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
我有此服务帐户数据(project_id
,private_key
,private_key_id
等)
I have this service account data (project_id
, private_key
, private_key_id
, etc.)
我应该如何授权使用此acc?
How should i authorize using this acc?
推荐答案
如果您将名为GOOGLE_APPLICATION_CREDENTIALS
的环境变量设置为指向服务帐户JSON文件的路径,则Firebase CLI会自动选择该变量并将其用于授权命令.在这种情况下,您无需登录或提供--token
参数.
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.
这篇关于使用gcloud服务帐户登录Firebase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!