talkiq / gcloud-aio

(Asyncio OR Threadsafe) Google Cloud Client Library for Python
https://talkiq.github.io/gcloud-aio
270 stars 89 forks source link

fix(auth): use iap aud for gce metadata server #646

Closed jonathan-johnston closed 11 months ago

jonathan-johnston commented 11 months ago

Summary

The official documentation is wrong on this, we need to fetch the ID token from the GCE metadata server using the typical audience value instead of the URI as stated here: https://cloud.google.com/docs/authentication/get-id-token#metadata-server

jonathan-johnston commented 11 months ago

@TheKevJames I believe that was actually a different use case, using the user auth method with SA impersonation. I reproduced the failure in staging with the metadata server ID token fetch, so at least it should fail consistently.