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.
Installation
Create a client
context.Context first and returns typed errors.
Agents and authorization
client.Delegation, client.Audit and client.Auth.
MCP servers
Plugin endpoints
Call routes declared withdefineEndpoint 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.
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 witherror="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).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: