【问题标题】:Allow google cloud compute to access firestore允许谷歌云计算访问firestore
【发布时间】:2021-04-15 14:36:59
【问题描述】:

我在谷歌云计算上设置了一个小型虚拟机。我希望它能够访问我的 firestore 数据库,但我无法让它工作。 我尝试在 vm 中使用 firebase-admin 库,但它出现了权限被拒绝错误。我的firestore规则很好。 你知道怎么做吗?

谢谢!

【问题讨论】:

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


【解决方案1】:

我根据 OP 的评论创建了这个社区 wiki,正如在下一个 post 中提到的解决方案。

需要为虚拟机实例 details 的 Google Cloud Console 上的服务启用 Cloud API 访问范围

documentation中所述,需要停止实例以更改API范围

【讨论】:

    【解决方案2】:

    您需要将Cloud Datastore UserIAM role添加到该实例使用的服务帐户,并在该实例上将Cloud Datastoreaccess scope设置为Enabled

    如果您的 Firestore 托管在与运行计算实例的 GCP 项目不同的 GCP 项目上,您还需要通过 IAM 将该服务帐号添加到 Firestore 的 GCP 项目中,然后在那里为其赋予相同的角色。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-02
      • 1970-01-01
      • 1970-01-01
      • 2018-11-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多