Skip to content

OpenAI ChatGPT Plus OAuth Token Exchange Failed with 403 #14705

@mumudog-16

Description

@mumudog-16

Description

When trying to connect ChatGPT Plus subscription via OAuth in OpenCode, the browser authentication succeeds and redirects to http://localhost:1455/auth/callback?code=...&state=..., but OpenCode fails to save the credentials. The log shows Token exchange failed: 403 failed. After restarting OpenCode, no OpenAI models appear in the model list.

Additional Context

  • Browser shows successful redirect to http://localhost:1455/auth/callback?code=...
  • OAuth server on port 1455 is running correctly
  • The issue persists even with proxy completely disabled (unset ALL_PROXY)
  • auth.json only contains other providers (zenmux, opencode, streamlake, google) but no OpenAI entry

Plugins

No response

OpenCode version

1.2.10

Steps to reproduce

  1. Run /connect in OpenCode TUI
  2. Select OpenAI provider
  3. Select ChatGPT Plus/Pro option
  4. Complete browser authentication (login succeeds, redirect to localhost callback URL)
  5. OpenCode shows no success message, no "✓ Login successful" popup
  6. Check ~/.local/share/opencode/auth.json - no OpenAI credentials saved
  7. Restart OpenCode, run /models - no OpenAI models available

Screenshot and/or share link

No response

Operating System

macOS

Terminal

Terminal

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions