Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
160 views
in Technique[技术] by (71.8m points)

How do I allow a team member to use my Google Cloud Speech-to-Text API account?

I enabled the Google Cloud Speech-to-Text API, but I would like to allow a team member to use it on my account.

I went into IAM to add a new user, but I don't see any roles related to Cloud Speech-to-Text API. What IAM role(s) do I need to select to allow the new team member access to the API?

question from:https://stackoverflow.com/questions/65713601/how-do-i-allow-a-team-member-to-use-my-google-cloud-speech-to-text-api-account

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Text-to-speech API is a special (old?) API at Google and doesn't require role. The API URL also doesn't require project definition. So, you need an account linked to the project to be able to reach the Speech-to-text API.

For this, the "service-account" account is the account to use. So, the users need to use a service account to reach the API. To prevent the service account key file generation (source of potential security issue), prefer the impersonation.

With the gcloud cli you can do this to generate a valid access-token on behalf of the service account.

gcloud auth print-access-token --impersonate-service-account=<the service account to impersonate>

So, in your API call, from your computer (I mean with your own user credential) you can do like this

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...