无法将 API 密钥与 GCP 的 python 发现客户端一起使用
我的问题是我们可以将角色绑定到 API 密钥吗?如果可以的话,如何绑定?
如果不支持哪些服务,那么 GCP 上的所有服务是否都支持 API 密钥?
另外,为什么要使用服务帐户而不是 API 密钥?
from googleapiclient import discovery
storage_service = discovery.build('storage', 'v1', developerKey="AIzaSyhidingKeyVm60c")
storage_service.buckets().list(project='my-project').execute()
my question is can we bind roles to API Keys if so, how?
Are the API Keys supported for all the services across GCP if not which ones?
also, why to use service account over API keys?
from googleapiclient import discovery
storage_service = discovery.build('storage', 'v1', developerKey="AIzaSyhidingKeyVm60c")
storage_service.buckets().list(project='my-project').execute()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我鼓励您阅读 Google 的文档,例如身份验证概述,它是权威且全面的。
API 密钥:
角色是基于角色的访问控制 (RBAC) 的一个元素,对于 Google Cloud IAM(概述< /a>) 绑定到用户、服务帐户和组以定义访问策略。
访问不属于用户的数据的程序通常应作为服务帐户运行。
访问用户拥有的数据的程序应使用用户的凭据进行身份验证。
I encourage you to read Google's documentation, e.g. authentication overview, it is definitive and comprehensive.
API keys:
Roles are an element of role-based access control (RBAC) and, with Google Cloud IAM (overview) are bound to users, service accounts and groups to define access policies.
Programs accessing data not owned by users should generally run as a service account.
Programs accessing data owned by users should authenticate using the user's credentials.