[PR #11832] feat(auth): multi-account OAuth support with auto-relogin #13944

Open
opened 2026-02-16 18:18:46 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/11832

State: open
Merged: No


Summary

  • Add support for multiple OAuth accounts per provider with automatic credential rotation
  • Implement browser-based auto-relogin for expired tokens using Puppeteer
  • Track per-request credentials with AsyncLocalStorage context

Closes #11830

Changes

Backend

File Description
auth/index.ts Multi-record OAuth store (add/remove/list accounts)
auth/rotating-fetch.ts Automatic failover on rate limits or auth failures
auth/browser.ts Puppeteer-based session management for auto-relogin
auth/credential-manager.ts Event-driven failover notifications
auth/context.ts AsyncLocalStorage for per-request credential tracking
config/config.ts oauth config block (cooldowns, retries, max attempts)
cli/cmd/auth.ts Browser session management CLI commands
server/routes/provider.ts Account CRUD, usage, browser session API endpoints
server/server.ts Root-level auth routes
provider/provider.ts Rotating-fetch integration

Frontend

File Description
settings-providers.tsx Manage accounts, set active, view usage
session-context-tab.tsx Show active account per session
dialog-settings.tsx Settings tabs structure

SDK

  • Regenerated from server routes with all new endpoints
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/11832 **State:** open **Merged:** No --- ## Summary - Add support for multiple OAuth accounts per provider with automatic credential rotation - Implement browser-based auto-relogin for expired tokens using Puppeteer - Track per-request credentials with AsyncLocalStorage context Closes #11830 ## Changes ### Backend | File | Description | |------|-------------| | `auth/index.ts` | Multi-record OAuth store (add/remove/list accounts) | | `auth/rotating-fetch.ts` | Automatic failover on rate limits or auth failures | | `auth/browser.ts` | Puppeteer-based session management for auto-relogin | | `auth/credential-manager.ts` | Event-driven failover notifications | | `auth/context.ts` | AsyncLocalStorage for per-request credential tracking | | `config/config.ts` | `oauth` config block (cooldowns, retries, max attempts) | | `cli/cmd/auth.ts` | Browser session management CLI commands | | `server/routes/provider.ts` | Account CRUD, usage, browser session API endpoints | | `server/server.ts` | Root-level auth routes | | `provider/provider.ts` | Rotating-fetch integration | ### Frontend | File | Description | |------|-------------| | `settings-providers.tsx` | Manage accounts, set active, view usage | | `session-context-tab.tsx` | Show active account per session | | `dialog-settings.tsx` | Settings tabs structure | ### SDK - Regenerated from server routes with all new endpoints
yindo added the pull-request label 2026-02-16 18:18:46 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13944