Skip to content

Instantly share code, notes, and snippets.

@mattes
Created Sep 10, 2020
Embed
What would you like to do?
Get access token via curl for default service account on Google Cloud Compute Engine
METADATA=http://metadata.google.internal/computeMetadata/v1
SVC_ACCT=$METADATA/instance/service-accounts/default
ACCESS_TOKEN=$(curl -H 'Metadata-Flavor: Google' $SVC_ACCT/token | cut -d'"' -f 4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment