OpenAI Authorization 403 Error #4797

Closed
opened 2026-02-16 17:45:28 -05:00 by yindo · 5 comments
Owner

Originally created by @syw2014 on GitHub (Jan 11, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

After install opencode , I had auth OpenAI plus,erros bellow:

Waiting for authorization..Error: Unexpected error, check log file at /Users/jerryshi/.local/share/opencode/log/2026-01-12T024753.log for more details

error: Token exchange failed: 403
at exchangeCodeForTokens (src/plugin/codex.ts:121:15)
at processTicksAndRejections (native:7:39)

Plugins

No response

OpenCode version

1.1.13

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

Macos 26.2 (25C56)

Terminal

No response

Originally created by @syw2014 on GitHub (Jan 11, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description After install opencode , I had auth OpenAI plus,erros bellow: Waiting for authorization..Error: Unexpected error, check log file at /Users/jerryshi/.local/share/opencode/log/2026-01-12T024753.log for more details error: Token exchange failed: 403 at exchangeCodeForTokens (src/plugin/codex.ts:121:15) at processTicksAndRejections (native:7:39) ### Plugins _No response_ ### OpenCode version 1.1.13 ### Steps to reproduce _No response_ ### Screenshot and/or share link _No response_ ### Operating System Macos 26.2 (25C56) ### Terminal _No response_
yindo added the bug label 2026-02-16 17:45:28 -05:00
yindo closed this issue 2026-02-16 17:45:28 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 11, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #7770: openai auth after v1.1.11 fatal error - similar OpenAI authorization issues after recent updates
  • #7565: OpenAI auth had fatal error after successful auth - same fatal error pattern when completing OpenAI authentication
  • #7745: Bug: Cannot Connect ChatGPT Plus Subscription with OpenCode 1.1.12 - ChatGPT Plus connection issues
  • #6083: Token refresh failed: 403 failed with github copilot - similar 403 token exchange failures (though with Copilot provider)

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 11, 2026): This issue might be a duplicate of existing issues. Please check: - #7770: openai auth after v1.1.11 fatal error - similar OpenAI authorization issues after recent updates - #7565: OpenAI auth had fatal error after successful auth - same fatal error pattern when completing OpenAI authentication - #7745: Bug: Cannot Connect ChatGPT Plus Subscription with OpenCode 1.1.12 - ChatGPT Plus connection issues - #6083: Token refresh failed: 403 failed with github copilot - similar 403 token exchange failures (though with Copilot provider) Feel free to ignore if none of these address your specific case.
Author
Owner

@zizhen01 commented on GitHub (Jan 11, 2026):

Same issue here

`◑ Waiting for authorization..Error: Unexpected error, check log file at /Users/xx/.local/share/opencode/log/2026-01-12T025639.log for more details

error: Token exchange failed: 403
at exchangeCodeForTokens (src/plugin/codex.ts:121:15)
at processTicksAndRejections (native:7:39)

■ Canceled`

@zizhen01 commented on GitHub (Jan 11, 2026): Same issue here `◑ Waiting for authorization..Error: Unexpected error, check log file at /Users/xx/.local/share/opencode/log/2026-01-12T025639.log for more details error: Token exchange failed: 403 at exchangeCodeForTokens (src/plugin/codex.ts:121:15) at processTicksAndRejections (native:7:39) ■ Canceled`
Author
Owner

@syw2014 commented on GitHub (Jan 11, 2026):

Same issue here

`◑ Waiting for authorization..Error: Unexpected error, check log file at /Users/xx/.local/share/opencode/log/2026-01-12T025639.log for more details

error: Token exchange failed: 403 at exchangeCodeForTokens (src/plugin/codex.ts:121:15) at processTicksAndRejections (native:7:39)

■ Canceled`
I retried the authentication and found the root cause.
The issue was related to the VPN routing. With split-tunneling enabled, the browser authorization succeeded, but the CLI token exchange failed with 403.
After switching the VPN to global mode with enhanced/TUN mode enabled, the OAuth flow completed successfully.

@syw2014 commented on GitHub (Jan 11, 2026): > Same issue here > > `◑ Waiting for authorization..Error: Unexpected error, check log file at /Users/xx/.local/share/opencode/log/2026-01-12T025639.log for more details > > error: Token exchange failed: 403 at exchangeCodeForTokens (src/plugin/codex.ts:121:15) at processTicksAndRejections (native:7:39) > > ■ Canceled` I retried the authentication and found the root cause. The issue was related to the VPN routing. With split-tunneling enabled, the browser authorization succeeded, but the CLI token exchange failed with 403. After switching the VPN to global mode with enhanced/TUN mode enabled, the OAuth flow completed successfully.
Author
Owner

@zerogog commented on GitHub (Jan 12, 2026):

403 means forbidden. If you not use proxy, use it. If you used proxy, switch it. Same for codex cli.

@zerogog commented on GitHub (Jan 12, 2026): `403` means forbidden. If you not use proxy, use it. If you used proxy, switch it. Same for `codex` cli.
Author
Owner

@shiboyu1999 commented on GitHub (Jan 18, 2026):

Same issue here
◑ Waiting for authorization..Error: Unexpected error, check log file at /Users/xx/.local/share/opencode/log/2026-01-12T025639.log for more details error: Token exchange failed: 403 at exchangeCodeForTokens (src/plugin/codex.ts:121:15) at processTicksAndRejections (native:7:39) ■ Canceled
I retried the authentication and found the root cause.
The issue was related to the VPN routing. With split-tunneling enabled, the browser authorization succeeded, but the CLI token exchange failed with 403.
After switching the VPN to global mode with enhanced/TUN mode enabled, the OAuth flow completed successfully.

My hero!

@shiboyu1999 commented on GitHub (Jan 18, 2026): > > Same issue here > > `◑ Waiting for authorization..Error: Unexpected error, check log file at /Users/xx/.local/share/opencode/log/2026-01-12T025639.log for more details > > error: Token exchange failed: 403 at exchangeCodeForTokens (src/plugin/codex.ts:121:15) at processTicksAndRejections (native:7:39) > > ■ Canceled` > > I retried the authentication and found the root cause. > > The issue was related to the VPN routing. With split-tunneling enabled, the browser authorization succeeded, but the CLI token exchange failed with 403. > > After switching the VPN to global mode with enhanced/TUN mode enabled, the OAuth flow completed successfully. My hero!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4797