oauth2 NewClient InsecureSkipVerify
https://github.com/terraform-providers/terraform-provider-github/blob/master/github/config.go
ctx := context.Background()
insecureClient := &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
},
},
}
ctx = context.WithValue(ctx, oauth2.HTTPClient, insecureClient)
client := oauth2.NewClient(ctx, oauth2.StaticTokenSource(&oauth2.Token{
AccessToken: c.Param("accesstoken"),
TokenType: "Bearer",
}))
resp, err := client.Get("https://ory-hydra-login-consent:9020/openid/userinfo")
if err != nil {
return newHTTPError(400, "InvalidToken", err.Error())
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return newHTTPError(400, "InvalidToken", err.Error())
}
c.Logger().Debugf("resp: %s", body)
var t map[string]interface{}
err = json.Unmarshal(body, &t)
if err != nil {
return newHTTPError(400, "InvalidToken", err.Error())
}
return c.JSON(http.StatusOK, t)