anomalyco / anomalyco/opencode
Desktop app: "ChatGPT Plus/Pro" device authorization fails with 403 (Token exchange failed / Failed to initiate device authorization)
@rekram1-node is already working on this.
Since Aug 7, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
Environment
Platform: macOS
App: OpenCode desktop app (app.asar bundled, @opencode-ai/plugin@local dependency install warning present)
Provider: built-in openai (ChatGPT Plus/Pro subscription, device/authorization-code flow)
Describe the bug When adding the OpenAI provider via ChatGPT Plus/Pro login, the device authorization flow fails repeatedly with 403:
Error: Token exchange failed: 403
Error: Failed to initiate device authorization
Both originate in exchangeCodeForTokens / ProviderAuth.authorize on the opencode auth server side. A DeepSeek API key stored alongside works fine, so it's specific to the OAuth/device flow.
Steps to reproduce
Open the desktop app → Settings → add OpenAI provider
Select ChatGPT Plus/Pro login
Observe 403 on device authorization / token exchange
Expected behavior The browser opens the OpenAI authorization page; after approving, the app exchanges the code for a token and the ChatGPT models become available.
Actual behavior Authorization is rejected with 403 before/at token exchange.
Logs
timestamp=... level=ERROR run=... message=failed ref=err_... error="Error: Token exchange failed: 403"
cause="Error: Token exchange failed: 403
at exchangeCodeForTokens (.../node-paSOqpta.js:398919:11)
at ProviderAuth.callback (.../node-paSOqpta.js:669764:39)
at Server.listen (.../node-paSOqpta.js:671710:52)"
timestamp=... level=ERROR run=... message=failed ref=err_... error="Error: Failed to initiate device authorization"
cause="Error: Failed to initiate device authorization
at Object.authorize (.../node-paSOqpta.js:399213:21)
at ProviderAuth.authorize (.../node-paSOqpta.js:669751:46)
at ProviderHttpApi.authorizeRaw (.../node-paSOqpta.js:385447:31)"
Notes
Region/network: user's IP may be outside regions supported for the OpenAI device flow (possible cause).
Secondary: desktop bundle emits repeated background dependency install failed ... @opencode-ai/plugin@local: No matching version found warnings — a packaging issue, seemingly unrelated, worth a separate look.
Would be helpful if the server returned a clearer error (e.g. region-not-supported, account-eligibility) instead of a bare 403.
opencode-debug-20260806T182010.zip
Plugins
No response
OpenCode version
mac 1.18.14 (1.18.14)
Steps to reproduce
No response
Screenshot and/or share link
Operating System
macos 14.8
Terminal
GUI
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.