07-client-sdk

command
v0.1.35 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

README

07: Client SDK — Production Patterns

Non-UI · No infrastructure needed · Builds on Examples 01-06

Production token-acquisition patterns: discovery-driven configuration, automatic token caching, scope step-up — all behind the TokenSource interface. Same SDK works against OneAuth and Keycloak.

Two-process architecture

main.go boots an auth server (registration + token + discovery) and a resource server. The walkthrough uses client.AuthClient and client.ClientCredentialsSource — the same library code your apps import in production.

Quick start

make demo                              # interactive walkthrough
make serve                             # auth :8081, resource :8082

Optional: against Keycloak

cd ..  && make upkcl
cd 07-client-sdk && make demo          # last step uses the SDK against KC

See WALKTHROUGH.md for the full step-by-step.

Targets

make … What
demo (default) Walkthrough with TUI renderer
demo-plain Plain renderer
demo-ci Non-interactive
serve Bind AS + RS on real ports
walkthrough Regenerate WALKTHROUGH.md

What's next

08 — Rich Authorization Requests — RFC 9396 fine-grained permissions beyond flat scopes.

Documentation

Overview

Example 07: Client SDK — Production Patterns.

Examples 01-06 made raw `http.Post` calls. This one shows how production client code uses OneAuth's SDK: discovery-driven configuration, automatic token caching, scope step-up, all behind the `TokenSource` interface.

Two-process architecture:

make serve   # auth :8081 with token + discovery, resource :8082
make demo    # walkthrough that drives both

See: https://www.rfc-editor.org/rfc/rfc6749#section-4.4

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL