Skip to content

Codex Auth incorrectly treats different Team users as duplicate main login #51

Description

@mincia1110

When adding a ChatGPT Team account to Codex Auth, opencodex rejects it as:

Account is already used by the main Codex login.

In my case the main Codex login and the account being added have different emails and different user ids, but their JWTs share the same https://api.openai.com/auth.chatgpt_account_id.

Observed locally:

  • main Codex auth email: test_account1@gmail.com
  • added OAuth email: test_account2@gmail.com
  • both tokens report the same chatgpt_account_id
  • user ids / sub differ

This looks like chatgpt_account_id can identify the Team/workspace account, not the individual user. checkAccountIdCollision() currently treats a matching main chatgpt_account_id as a duplicate unconditionally.

I tested a local fix:

  • extract email from https://api.openai.com/profile.email
  • only treat the main Codex login as duplicate when both account id and email match, or when email is unavailable
  • keep the existing pool collision behavior scoped by plan bucket

Validation:

  • bun test tests/chatgpt-oauth.test.ts tests/codex-auth-collision.test.ts
  • bun run typecheck

If that approach sounds reasonable, I’m happy to open a small PR.

Activity

  1. lidge-jun commented on Jun 30, 2026

    @lidge-jun
    Owner

    Could you try in latest version? I small patched but I couldn't E2E, could you give me a screenshot or something?

  2. mincia1110 commented on Jun 30, 2026

    @mincia1110
    ContributorAuthor

    Confirmed on v2.6.14: this appears fixed.

    For context, I originally reproduced and filed this issue while testing v2.6.10, where adding the ChatGPT Team account failed with:

    Account is already used by the main Codex login.

    After updating to v2.6.14, I retried the dashboard E2E flow and was able to add the same Team account successfully.

    So the latest behavior matches the fix in 0da08f9:

    • main Codex login and managed pool accounts are treated separately
    • matching chatgpt_account_id alone no longer blocks adding a pool account
    • the Team account add flow now works for my case

    Thanks for the quick patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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