Fetch-url-http-3a-2f-2fmetadata.google.internal-2fcomputemetadata-2fv1-2finstance-2fservice Accounts-2f -
default/
my-custom-sa@project-id.iam.gserviceaccount.com/
Each entry is a directory containing metadata about that service account. Typically, every GCE instance has at least the default compute engine service account.
URL: /computeMetadata/v1/instance/service-accounts/default/token
Result: A JSON object containing an access_token you can use in Authorization headers. default/
my-custom-sa@project-id
The presence of fetch-url-http-3A-2F-2F... in a search term or log indicates a probable misencoding scenario. For example, someone might have written: Each entry is a directory containing metadata about
// Wrong: URL-encoding the entire URL
fetch(encodeURIComponent("http://metadata.google.internal/..."))
Or a logging system double-encoded an error message. The correct approach is to never URL-encode the base URL of the metadata server. Only query parameters (if any) should be encoded. Or a logging system double-encoded an error message
Example token response (JSON):
"access_token": "ya29....",
"expires_in": 3599,
"token_type": "Bearer"
Let’s walk through the path:
/computeMetadata/v1/instance/service-accounts/