Fetch-url-http-3a-2f-2fmetadata.google.internal-2fcomputemetadata-2fv1-2finstance-2fservice Accounts-2f Site

The URL is:

http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/

URL: /computeMetadata/v1/instance/service-accounts/default/token Result: A JSON object containing an access_token you can use in Authorization headers. The URL is: http://metadata

package main

import ( "fmt" "io/ioutil" "net/http" )

func main() { url := "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Metadata-Flavor", "Google") client := &http.Client{} resp, _ := client.Do(req) body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } All requests to the Compute Engine metadata server

All requests to the Compute Engine metadata server must include the header: _ := http.NewRequest("GET"