gpt4 book ai didi

google-cloud-platform - 如何允许团队成员使用我的 Google Cloud Speech-to-Text API 帐户?

转载 作者:行者123 更新时间:2023-12-04 08:15:45 25 4
gpt4 key购买 nike

我启用了 Google Cloud Speech-to-Text API,但我希望允许团队成员在我的帐户中使用它。
我进入 IAM 以添加新用户,但我没有看到任何与 Cloud Speech-to-Text API 相关的角色。我需要选择什么 IAM 角色才能允许新团队成员访问 API?

最佳答案

Text-to-speech API 是 Google 的一个特殊(旧?)API,不需要角色。 API URL 也不需要项目定义。因此,您需要一个链接到项目的帐户才能访问 Speech-to-text API。
为此,“服务帐户”帐户是要使用的帐户。因此,用户需要使用服务帐户来访问 API。要防止服务帐户 key 文件生成(潜在安全问题的来源),请首选 impersonation .
使用 gcloud cli,您可以执行此操作以代表服务帐户生成有效的访问 token 。

gcloud auth print-access-token --impersonate-service-account=<the service account to impersonate>
因此,在您的 API 调用中,从您的计算机(我的意思是使用您自己的用户凭据),您可以这样做
curl -d @inputdata -H "content-type: application/json" \
-H "Authorization: Bearer $(gcloud auth print-access-token --impersonate-service-account=<the service account to impersonate>)" \
https://speech.googleapis.com/v1/speech:recognize

关于google-cloud-platform - 如何允许团队成员使用我的 Google Cloud Speech-to-Text API 帐户?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65713601/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com