Skip to content

Feature Request: Support multiple OpenAI OAuth accounts #458

@ThreeIce

Description

@ThreeIce

Problem

Currently, the OpenAI OAuth integration only supports a single account at a time. The credential storage in src/lib/openai-oauth-manager.ts uses flat, single-slot keys (e.g. openai_oauth_access_token, openai_oauth_account_id), so logging in with a new account silently overwrites the existing one.

Users who want to switch between a personal ChatGPT Plus account and a work/team account have no way to do so without fully logging out and back in.

Expected Behavior

Users should be able to:

  • Add and save multiple OpenAI OAuth accounts
  • Switch between accounts without losing the others
  • Remove individual accounts independently

Current Behavior

  • saveTokens() overwrites the single credential slot on every login
  • clearOAuthTokens() wipes all credentials with no per-account scope
  • startOAuthFlow() cancels any pending flow with "Superseded by new login attempt" — no parallel account support

Suggested Implementation Direction

A keyed storage approach (e.g. by accountId) would be needed, along with:

  • An account list UI in ProviderManager
  • Per-account token refresh in ensureTokenFresh()
  • Active account selection state

This is a feature request, not a bug report. Happy to discuss the design if the team is open to it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions