Google Speech API returns 403 PERMISSION_DENIED

I have been using the Google Speech API to transcribe audio to text from my PHP application (using the Google Cloud PHP Client) for several months without any problem. But my calls have now started returning 403 errors with the status "PERMISSION_DENIED" and the message "The caller has no permission".

I am using the Speech API along with Google Storage. I am checking using the service account and submitting my audio data to storage. This works, the file is loaded. So I understand - but could I be wrong? - that the "caller" does not have permission to then read the audio data from the repository.

I get permissions with no problem using google console. I've read the docs but am pretty confused. The service account I'm using (I'm assuming this is the "caller"?) Has owner rights to the project. And everything was fine, I didn't change anything.

I am not posting the code because if I understand correctly, my application code is not the problem - it is rather my Google Cloud settings. I would be grateful for any idea or clarification of concepts!

Thank.

+4


source to share


2 answers


Owning the project does not necessarily mean that the service account has read permission on the object. The object may have been loaded by another account that specified a private ACL or similar.

Make sure the service account has access to the object by giving it the necessary permissions for the entire bucket or for a specific object.

You can do this using gsutil acl . More details and additional methods can be found in the official documentation .

For example, the following command grants READ permission to your service account object:



gsutil acl -r ch -u serviceAccount@domain.com:R gs://bucket/object

      

And this command gives READ permission to the whole bucket of your service account:

gsutil acl -r ch -u serviceAccount@domain.com:R gs://bucket

      

+3


source


In Google Cloud Vision, when you create credentials with a service account key, you need to create a role and assign it as owner, and get full access rights.



0


source







All Articles