Skip to content

OpenAI OAuth creates duplicate accounts and disables valid logins #156

@tdecaluwe

Description

@tdecaluwe

Bug Description
OpenAI OAuth login succeeds, but oc-codex-multi-auth creates two entries for the same identity (Personal workspace + Token account) and then marks the account disabled/ineligible because it enforces connector scopes that OpenAI did not grant.

Steps to Reproduce

  1. Install/configure oc-codex-multi-auth in opencode.
  2. Run opencode auth login.
  3. Choose OpenAI → Codex OAuth (Device Code) and complete login successfully.
  4. Run codex-list, codex-status, or codex-dashboard.

Expected Behavior

  • One successful OpenAI OAuth login should create one usable account.
  • The account should be eligible for normal model/auth usage after login.
  • Missing connector-specific scopes should not disable baseline OpenAI OAuth usage.

Actual Behavior

  • Login succeeds, but two entries are created for the same identity: a workspace/org account and a token account
  • The returned OAuth scope only contains openid, profile, email and offline_access
  • The plugin then marks the account as disabled/blocked/ineligible because it expects api.connectors scopes

Environment

  • opencode version: 1.15.5
  • Plugin version: oc-codex-multi-auth@6.1.9
  • Operating System: Linux
  • Node.js version: v24.15.0

Compliance Checklist
Please confirm:

  • I'm using this plugin for personal development only
  • I have an active ChatGPT Plus/Pro subscription
  • This issue is not related to attempting commercial use or TOS violations
  • I've reviewed the FAQ and Troubleshooting sections

Additional Context
Relevant logic appears to be in lib/accounts/state.ts:

enabled: account.enabled !== false && (!shouldEnforceScope || missingOAuthScopes.length === 0)

This means a normal OpenAI OAuth login can succeed but still be disabled because OpenAI did not grant the connector scopes. It also appears the fallback/token account creation path can produce a duplicate account entry for the same underlying identity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions