teleport/examples/go-client
Reed Loden 83eb9b2acb
Bump go.mod to use Go 1.18 (#13771)
We're now using Go 1.18 features (native fuzzing in https://github.com/gravitational/teleport/pull/13473),
which means we need to accurately state that we require Go 1.18 in our go.mod.
2022-06-29 02:14:12 +00:00
..
access-admin.yaml Update go-client to user new API client with tsh profile loader. (#6310) 2021-04-15 10:10:25 -07:00
go.mod Bump go.mod to use Go 1.18 (#13771) 2022-06-29 02:14:12 +00:00
go.sum update api versions in examples go.mod (#11574) 2022-03-31 14:15:53 +00:00
main.go use google/uuid instead of pborman/uuid (#9793) 2022-01-19 23:44:48 +00:00
README.md Refactor api package and docs to use pkg.go.dev effectively. (#6388) 2021-04-20 16:44:17 -07:00

Teleport Auth Go Client

This program demonstrates how to...

  1. Authenticate the client using credential loaders.
  2. Authorize API calls using an independent user and role.
  3. Create a new client and make API calls to the Auth server.

Demo

This demo can be used to quickly get the API client up and running.

Create resources

Create the access-admin user and role using the following commands:

$ tctl create -f access-admin.yaml
$ tctl users add access-admin --roles=access-admin
Generate Credentials

Login with tsh to generate Profile credentials.

# login and automatically generate keys
$ tsh login --user=access-admin

NOTE: You can pass the InsecureAddressDiscovery in client.Config field to skip verification of the TLS certificate of the proxy. Don't do this for production clients.

Run
$ go run main.go

Reference

To see more information on the Go Client and how to use it, visit our API documentation: