Skip to content

Use cases

Each card below maps to a runnable example under examples/ in the source repo. Examples build behind the example build tag so they don't bloat your go.sum or get pulled into go test ./...:

sh
(cd examples/01-minimal && go run -tags example .)

Most pages start with the same decision shape:

  • What problem this solves. The opening paragraphs explain the pressure that makes the feature useful, not just the option name.
  • When to use it. Advanced pages call out the deployment shape where the feature earns its complexity.
  • When not to use it. If a simpler built-in path is enough, the page points you there before diving into code.

If you are new to the library, start with Minimal OP, then Comprehensive bundle, and only jump to the pages below when your deployment has that specific need.

Index

Every example folder maps to one of the use-case pages below.

Bootstrap & wiring

Use caseExamplePage
Smallest possible OP01-minimalMinimal OP
Comprehensive bundle (every option a typical embedder uses)02-bundleComprehensive bundle

Profile & flow

Use caseExamplePage
Plain OAuth 2.0 alongside OIDC04-oauth2-onlyOAuth 2.0 (no openid)
FAPI 2.0 Baseline (PAR + JAR + DPoP)03-fapi2, 50-fapi-tls-jwksFAPI 2.0 Baseline
Service-to-service tokens05-client-credentialsclient_credentials
DPoP server nonce flow51-dpop-nonceDPoP nonce flow

UI

Use caseExamplePage
Drive UI from a SPA16-custom-interaction, 10-react-loginSPA / custom interaction
Custom HTML consent page11-custom-consent-uiCustom consent UI
Custom HTML account chooser12-custom-chooser-uiCustom chooser UI
Multi-account chooser (prompt=select_account)13-multi-accountMulti-account chooser
Cross-origin SPA (CORS)14-cors-spaCORS for SPA
Locale negotiation15-i18n-localei18n / locale

Storage

Use caseExamplePage
Persist on a real database06-sql-store, 07-mysql-storePersistent storage (SQL)
Rename SQL adapter tables25-byo-table-namesPersistent storage (SQL) § Renaming the tables
Implement a store from scratch26-byo-store-from-scratchBring your own store backend
Hot/cold split (Redis volatile)08-composite-hot-cold, 09-redis-volatileHot/cold + Redis

Scopes & claims

Use caseExamplePage
Public / internal scope split60-scopes-public-privatePublic / internal scopes
OIDC §5.5 claims request parameter61-claims-requestClaims request

Authentication

Use caseExamplePage
MFA, captcha, step-up20-mfa-totp, 21-risk-based-mfa, 22-login-captcha, 23-step-upMFA / step-up
Bring your own user store24-byo-userstoreBring your own user store

Advanced grants

Use caseExamplePage
Custom grant_type URN30-custom-grantCustom Grant
Device code (RFC 8628)31-device-code-cliDevice Code
CIBA poll mode32-ciba-posCIBA
Token Exchange (RFC 8693)33-token-exchange-delegationToken Exchange

Crypto & subjects

Use caseExamplePage
Pairwise subject (OIDC Core §8.1)34-pairwise-saasPairwise subject
Encrypted id_token (JWE)35-encrypted-id-tokenJWE encryption

Governance

Use caseExamplePage
First-party consent skip40-first-party-skip-consentFirst-party consent skip
Dynamic Client Registration (RFC 7591)41-dynamic-registrationDynamic Client Registration
Back-Channel Logout 1.042-back-channel-logoutBack-Channel Logout

Operations

Use caseExamplePage
Prometheus metrics52-prometheus-metricsPrometheus metrics

Numeric inventory

The example folders are grouped by topic, not by chronology:

BandTopic
00–09bootstrap, core flows, profiles, storage adapters
10–19UI and browser integration (SPA, consent, chooser, CORS, i18n)
20–29MFA, authentication rules, and user-store projection
30–39advanced grants, subject modes, encrypted tokens, federation
40–49governance: first-party, DCR, back-channel logout
50–59operations: FAPI helpers, metrics, tracing, DPoP nonce
60–69scopes, claims, and compliance-adjacent examples

The README in the source repo is the authoritative inventory.