Files
teleport/examples/go-client
teleport-renovate[bot]andChris Thach 04471ea746 Update Go version to v1.26.4 (#67476)
* Update Go version to v1.26.4

* Rm GO_VERSION from Makefile/Dockerfile and rely on go.mod to inform Go version. Update code to adhere to 1.26 deprecation/changes.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

* Bump e to 54d1d0cb67b71860b943de477b3146d32ccdd74a.

Signed-off-by: Chris Thach <chris.thach@goteleport.com>

---------

Signed-off-by: Chris Thach <chris.thach@goteleport.com>
Co-authored-by: teleport-renovate[bot] <275214890+teleport-renovate[bot]@users.noreply.github.com>
Co-authored-by: Chris Thach <chris.thach@goteleport.com>
2026-06-08 14:28:40 +00:00
..
2026-06-08 14:28:40 +00:00
2026-05-27 12:36:00 +00: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: