How i can authenticate the Google Cloud Video Intelligence API in a Golang Docker Container running on a GoogleVirtual Machine using a serviceAccount?

Viewed 16

I'm trying to make a request in Go client.AnnotateVideo(ctx, &annotateVideoRequest) to the Google Cloud Video Intelligence API using the package cloud.google.com/go/videointelligence/apiv1.

I noticed that if I'm on a Google VM, i don't need any credentials or environment variable because the API says:

For API packages whose import path is starting with "cloud.google.com/go", such as cloud.google.com/go/storage in this case, if there are no credentials provided, the client library will look for credentials in the environment.

But I guess I can't authenticate because I'm running a Docker Container inside the Google VM, and I don't know if I really need a credentials file in that docker container, because I don't know if the library automatically creates a credentials file, or it just check if there is a $GOOGLE_APPLICATION_CREDENTIALS and then use that (But that makes no sense. I'm on a GOOGLE VM, and I'm supposed to have that permission).

The error is:

PermissionDenied: The caller does not have permissions

Some links that might be helpful:

https://pkg.go.dev/cloud.google.com/go/storage

https://cloud.google.com/docs/authentication#environment-service-accounts

https://cloud.google.com/docs/authentication/production#auth-cloud-implicit-go

https://cloud.google.com/video-intelligence/docs/common/auth#adc

Thanks in advance!

0 Answers
Related