Hello,

I'm really puzzled.
I tried Set and Add. Request.Url.Query() is empty
Do I have to build the uri first before and then passing it to 
http.NewRequest?

func HybridFlow() {
   response_type := "code id_token"
   scope := "openid profile email"
   nonce := uniuri.New()
   state := uniuri.New()
   requri := "https://some_uri";
   client := http.DefaultClient
   client.Timeout = time.Second * 10
   req, e := http.NewRequest(http.MethodGet, requri, nil)
   if e != nil {
      log.Fatal(e)
   }
   req.URL.Query().Set("scope", scope)
   req.URL.Query().Set("response_type", response_type)
   req.URL.Query().Set("nonce", nonce)
   req.URL.Query().Set("state", state)
   req.URL.Query().Set("client_id", ClientID)
   req.URL.Query().Set("client_secret", ClientSecret)
   req.URL.Query().Set("redirect_uri", RedirectURI)

   fmt.Println("query", req.URL.Query())

   rsp, e := client.Do(req)
   if e != nil {
      log.Fatal(e)
   }
   fmt.Println(rsp)
   body, e := ioutil.ReadAll(rsp.Body)
   if e != nil {
      log.Fatal(e)
   }
   fmt.Printf("%s", body)
}

-- 
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.

Reply via email to