-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Closed
Description
Context
I'm the author of the recently opened auth-v2 PRs from a new GitHub account (my prior account lost access). One of the PRs was closed as potential spam — totally fair given the account/volume — so I'm starting an issue to discuss direction first.
The full RFC is in specs/provider-auth-v2.md (included in the PR branches).
Problem
Today's auth path is effectively single-credential and makes it hard to support:
- multiple OAuth subscription accounts per provider
- deterministic rotation/cooldowns on
429within the same user request - refresh-on-expired (
401/403) where supported - a single composable integration point across providers
Proposal (Auth v2)
- Encrypted-at-rest credential vault (AES-256-GCM) with atomic writes + lockfile coordination.
- Multi-record credential store (providerId + namespace + label), enabling multiple accounts per provider.
- Provider auth registry/adapters to unify OAuth flows + apply auth headers for Anthropic/OpenAI/Google/Copilot/Qwen/Cursor.
- Fetch-level rotation middleware:
- rotate on
429(Retry-After-aware) and retry within the same request - refresh on
401/403when supported - persist pool ordering + cooldowns
- rotate on
- Migrate legacy auth files into the new store; keep behavior compatible.
Optional UX/docs pieces:
- TUI connected-accounts management + rotation stats
- Opt-in OpenAI-compatible model discovery via
/modelswith caching - Vault key management commands (init/export/import)
PRs (if you'd like to review code)
- auth v2 core #5742 auth v2 core (currently closed)
- auth v2 credential ui #5743 TUI credential manager + rotation stats
- auth v2 model discovery #5744 opt-in model discovery
- auth v2 vault cli #5745 vault key CLI
- core oauth rotation #5746 combined PR
Questions
- Is this direction acceptable for OpenCode?
- Would you prefer the work reviewed as split PRs or as a single PR?
- Any preferences on vault key location / migration strategy / naming before I iterate further?
Metadata
Metadata
Assignees
Labels
No labels