[PR #6416] feat: add multi-account support for auth providers #11893

Closed
opened 2026-02-16 18:16:50 -05:00 by yindo · 0 comments
Owner

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

State: closed
Merged: No


Summary

  • Add support for multiple accounts per provider with active account switching
  • Automatic migration from legacy single-auth format

Changes

Auth Module (src/auth/index.ts)

  • New ProviderAuth data structure with accounts map and active field
  • New functions: listAccounts, setAccount, setActive, removeAccount, getAccount, hasAccounts, getActive
  • Backward-compatible migration: legacy single-auth entries auto-convert to multi-account format on read

CLI (src/cli/cmd/auth.ts)

  • auth list now shows accounts grouped by provider with active indicator
  • auth login accepts --account / -a flag to specify account name
  • auth logout allows removing specific accounts (not just entire providers)

TUI (src/cli/cmd/tui/component/dialog-provider.tsx)

  • New DialogAccounts component for listing/switching accounts
  • New DialogAccountName component for naming new accounts
  • Updated DialogAuthMethod to support account context

Server (src/server/server.ts)

  • New endpoints:
    • GET /auth/:providerID/accounts - List accounts
    • PUT /auth/:providerID/accounts/:accountName - Set account credentials
    • POST /auth/:providerID/accounts/:accountName/active - Set active account
    • DELETE /auth/:providerID/accounts/:accountName - Remove account

SDK

  • Regenerated with new auth.accounts.* methods
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/6416 **State:** closed **Merged:** No --- ## Summary - Add support for multiple accounts per provider with active account switching - Automatic migration from legacy single-auth format ## Changes ### Auth Module (`src/auth/index.ts`) - New `ProviderAuth` data structure with `accounts` map and `active` field - New functions: `listAccounts`, `setAccount`, `setActive`, `removeAccount`, `getAccount`, `hasAccounts`, `getActive` - Backward-compatible migration: legacy single-auth entries auto-convert to multi-account format on read ### CLI (`src/cli/cmd/auth.ts`) - `auth list` now shows accounts grouped by provider with active indicator - `auth login` accepts `--account` / `-a` flag to specify account name - `auth logout` allows removing specific accounts (not just entire providers) ### TUI (`src/cli/cmd/tui/component/dialog-provider.tsx`) - New `DialogAccounts` component for listing/switching accounts - New `DialogAccountName` component for naming new accounts - Updated `DialogAuthMethod` to support account context ### Server (`src/server/server.ts`) - New endpoints: - `GET /auth/:providerID/accounts` - List accounts - `PUT /auth/:providerID/accounts/:accountName` - Set account credentials - `POST /auth/:providerID/accounts/:accountName/active` - Set active account - `DELETE /auth/:providerID/accounts/:accountName` - Remove account ### SDK - Regenerated with new `auth.accounts.*` methods
yindo added the pull-request label 2026-02-16 18:16:50 -05:00
yindo closed this issue 2026-02-16 18:16:50 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11893