GeezerVison is showing github.com — openai: adding a second ChatGPT account fails with workspace scope denied · Issue #56298 · anomalyco/opencode
openai: adding a second ChatGPT account fails with workspace scope denied #56298DescriptionDescription
Adding another account with “Sign in with ChatGPT” fails on the OpenAI authorization page with 3p_login_workspace_scope_denied: the app is only available to members of its workspace. Removing the first saved account and then signing in with the second succeeds. Keeping one account on the new method and adding the other through “Codex browser (legacy)” also works.
In v2.0.32, the ChatGPT OAuth method takes the client ID from the active credential, including when the TUI starts “Add account”. OpenAI’s account-management guide says a different account should use its own saved registration or register a new one with client_id=dynamic_agent_client:
https://developers.openai.com/siwc/token-sharing-open-source/profiles-and-sessions#switching-chatgpt-accounts
Expected: adding the second account should leave the first account connected and start an independent registration. Reauthorizing an existing account should retain that account’s issued client ID.
Plugins
@cortexkit/opencode-magic-context@latest, @cortexkit/[email protected], oh-my-opencode-slim. Not yet reproduced with plugins disabled.
OpenCode version
2.0.32
Steps to reproduce
- Run
/connect, select OpenAI, then “Sign in with ChatGPT”, and sign in with account A.
- Run
/connect again, select OpenAI → “Add account” → “Sign in with ChatGPT”.
- Sign in with a different ChatGPT account B.
- Observe the workspace-scope denial. Remove A from OpenCode and repeat B’s sign-in; it succeeds.
Screenshot and/or share link
Not available.
Operating System
Linux x86_64 / WSL2, kernel 6.18.54.1-microsoft-standard-WSL2
Terminal
tmux (TERM=tmux-256color), zsh Reacted by Mariusz Józala, NODA Kai, Eli Stark and Hong Minhee (洪 民憙) Activityopencode-agent commented on Oct 17, 2026 Thanks for the detailed report. I couldn't reproduce this here: the denial comes from OpenAI's live sign-in page, and testing it needs two real ChatGPT accounts in different workspaces, which this sandbox doesn't have. A maintainer with such accounts will need to confirm it.
Your explanation matches the code, though I haven't run it. In packages/core/src/plugin/provider/chatgpt.ts, "Sign in with ChatGPT" takes its client ID from the active OpenAI credential and puts it in the authorize URL. It only falls back to dynamic_agent_client when no ID is saved. Nothing treats "Add account" differently from signing in again to an existing account, so account B's sign-in reuses account A's client ID. That code is the same in 2.0.32 and on dev.
Until this is looked at, the workaround you found still works: connect the second account through "Codex browser (legacy)".
Related: #52141 and #52147, the PRs that added this sign-in method.
iCodePoet commented on Nov 12, 2026 I'm experiencing the same issue on OpenCode 2.2.7 on macOS.
The first ChatGPT account connects successfully, but adding a different account via “Sign in with ChatGPT” fails with:
3p_login_workspace_scope_denied
Adding the second account via “Codex browser (legacy)” succeeds. KomeijiReimu commented on Nov 12, 2026 iCodePoet commented on Nov 12, 2026 @KomeijiReimu The core fix overlaps with #56302. The additional changes in #63517 cover reauthorization of a selected account in the web/desktop app, along with an E2E regression test. Feel free to use the app-related changes if they’re useful for your PR. xeonise commented on Nov 18, 2026 same issue being experienced KomeijiReimu commented on Nov 21, 2026
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|