Thanks for the ideas. I'm using OAuth2, not basic Auth.
I originally had the auth code in the header, but that resulted in a 401 because of this issue: https://nestdevelopers.io/t/rest-works-in-curl-but-not-in- python-requests-401-error/391/2 Below is the full Go script. The auth is working fine in Postman and Curl. I was hitting the 401 with both Python and Go. Using "params" fixed the issue in Python, so I'm looking for a similar fix in Go. I'll see if I can try Val's idea. I'm not much of a programmer. Just mucking around for now until I can get a real programmer on my team. package main import ( "fmt" "strings" "net/http" "io/ioutil" ) func main() { url := "https://developer-api.nest.com/structures" payload := strings.NewReader("code=xxxx&client_id=xxxx&client_secret=xxxx &grant_type=authorization_code") req, _ := http.NewRequest("GET", url, payload) req.Header.Add("content-type", "application/json") req.Header.Add("authorization", "Bearer xxxx") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } On Mon, Dec 12, 2016 at 10:03 PM, <paraiso.m...@gmail.com> wrote: > response = requests.request("GET", url, data=payload, headers=headers, >> *params=params*) > > > > if auth is a header then set the appropriate header : > > https://golang.org/pkg/net/http/#Header.Set > > if it is basic auth you need to implement then look at the spec : > > https://en.wikipedia.org/wiki/Basic_access_authentication > > You didn't explain what you expect "auth" or "params" to be . > > > Le mardi 13 décembre 2016 06:46:23 UTC+1, bet...@google.com a écrit : >> >> Hi, >> >> In Python, I can include params like this: >> >> ===================== >> >> *params = {'auth': 'XXXXXXXX'}* >> >> response = requests.request("GET", url, data=payload, headers=headers, >> *params=params*) >> >> ===================== >> >> Any pointers on how Golang does this? >> >> Thanks, >> Betsy >> > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.