Skip to content

Instantly share code, notes, and snippets.

@jangaraj

jangaraj/main.go Secret

Created January 21, 2019 19:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jangaraj/0e667d8aebadd46151fd0edcbf0a9f05 to your computer and use it in GitHub Desktop.
Save jangaraj/0e667d8aebadd46151fd0edcbf0a9f05 to your computer and use it in GitHub Desktop.
package main
import (
"crypto/tls"
"fmt"
"context"
"gopkg.in/resty.v1"
"golang.org/x/oauth2"
)
func main() {
conf := &oauth2.Config{}
token := &oauth2.Token{
AccessToken: "access token here",
TokenType: "bearer",
}
client := conf.Client(context.Background(), token)
rc := resty.NewWithClient(client)
rc.SetDebug(true)
rc.SetTLSClientConfig(&tls.Config{InsecureSkipVerify: true})
resp, err := rc.R().Get("https://untrusted-root.badssl.com/")
if err != nil {
fmt.Println("ERROR: " + err.Error())
} else {
fmt.Println("Response: " + resp.String())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment