使用GCP服务帐户登录Firebase

时间:2020-04-15 12:56:44

标签: firebase google-cloud-platform firebase-tools

我正在尝试使用GCP服务帐户登录Firebase Tools CLI。我有保存为GOOGLE_APPLICATION_CREDENTIALS的服务帐户凭据的路径。我已使用firebase logout注销了Firebase,并尝试使用firebase login --no-localhostfirebase login --no-localhost --token $GOOGLE_APPLICATION_CREDENTIALS使用服务帐户登录。但是,在两种情况下,都会打开Web浏览器,要求我使用用户帐户登录。如何使用服务帐户登录Firebase?

2 个答案:

答案 0 :(得分:2)

摘自Michael Bleighs评论:
“ Firebase CLI确实支持func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { for touch in touches { let touchPoint = touch.location(in: mapView) let location = mapView.convert(touchPoint, toCoordinateFrom: mapView) print ("\(location.latitude), \(location.longitude)") }} ,但是您无需“登录”它们。如果环境变量指向有效的服务帐户,则您应该能够像使用必须注销才能使GAC正常工作。如果尝试这样做时遇到错误,请使用--debug运行命令。“
我可以确认我有这个工作。请注意,您可能需要运行GOOGLE_APPLICATION_CREDENTIALS才能正常工作。

答案 1 :(得分:0)

您无法使用服务帐户登录Firebase项目。您需要在项目上使用协作者的正确用户帐户才能使用Firebase工具登录。

即使在using the CI integration时,文档也会指出:

  1. 通过运行以下命令来启动登录过程:

     firebase login:ci
    
  2. 访问提供的URL,然后使用Google帐户登录