Skip to main content
This is the Go REST client for a theAuth TypeScript server, source in sdks/go. It talks to the same REST API as @glinr/theauth-client. The Go server library is a separate project, theauth-go, see its docs.
The module path in sdks/go/go.mod is github.com/glincker/theauth-go, the same path as the server library repository, so go get below fetches the server library. Vendor sdks/go until the client gets its own path.

Installation

Requires Go 1.21 or newer. No external dependencies.

Create a client

Every method takes a context.Context first and returns typed errors.

Agents and authorization

Delegation, audit and human auth live on client.Delegation, client.Audit and client.Auth.

MCP servers

Plugin endpoints

Call routes declared with defineEndpoint on the Go server. The path below is an example of a route you define yourself, not one the library ships. This client talks to the Go server only: the TypeScript handler serves a different route set (see REST API).
client.Do(ctx, method, path, query, body, &out) is the short form without path parameters.

Devices

client.Devices is the registry and needs a user or admin token. client.Device is what a device calls as itself.
The signer makes a new device-assertion+jwt for every call, because the server accepts each jti once. A DevicePSK or DeviceToken works as the credential too.

Step-up and bound tokens

A 401 with error="insufficient_user_authentication" (RFC 9470) returns *theauth.ErrStepUpRequired. err.Challenge.AuthorizeParams() gives the acr_values and max_age for the new authorization request. ACRSatisfies and AuthIsFresh check a token before you call. Set Cnf: theauth.DPoPConfirmation(prover) on CreateAgentInput to bind an agent token to a DPoP key (RFC 7800). Agents.Rotate keeps the binding and Agents.RotateWith(ctx, id, theauth.RotateOptions{Unbind: true}) removes it. AuthorizeRequest.Inputs records what the model had in context for the audit log; the server hashes the content and does not store it.

Errors

All error types embed TheAuthError with Code, Message, StatusCode, Details and Issues.

DPoP

Bind tokens to a key with RFC 9449 proofs. The prover uses the standard library only (ECDSA P-256, ES256).
Each request carries a DPoP proof with htm, htu (no query or fragment), iat, jti and ath when a token is sent. A Bearer token is sent as Authorization: DPoP <token>. The DPoP-Nonce header is cached per origin and a use_dpop_nonce challenge is retried once. To wrap your own http.Client:
Last modified on November 1, 2026