Context
Part of #5016 (RFC: stacklok/toolhive-rfcs#70). Depends on #5027 (foundation).
Scope
- Token source implementing a three-tier strategy:
- In-memory cache
- Secrets-provider refresh token
- Browser OIDC+PKCE flow
- Preemptive refresh 30s before expiry
- Access tokens held in memory only — never written to disk or logged
- Refresh tokens stored via ToolHive's existing secrets provider (OS keyring / encrypted file fallback), using
ScopeLLM
thv llm token command — prints a fresh JWT to stdout (all other output on stderr), suitable for use as apiKeyHelper or auth.command
Acceptance Criteria
Dependencies
References
Context
Part of #5016 (RFC: stacklok/toolhive-rfcs#70). Depends on #5027 (foundation).
Scope
ScopeLLMthv llm tokencommand — prints a fresh JWT to stdout (all other output on stderr), suitable for use asapiKeyHelperorauth.commandAcceptance Criteria
thv llm tokenprints a fresh JWT to stdout with all other output on stderrthv llm tokenexits with an error in non-interactive mode when no cached or refreshable token exists — it never launches a browser flowDependencies
References