You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
opencode connect OpenAI, the OpenAI page said authorization successful, but opencode still Waiting for authorizationopencode 连接 OpenAI,OpenAI 页面显示授权成功,但 opencode 仍显示等待授权
Have you solved this problem? Could you please share your solution?
Please refer to the documentation at https://opencode.ai/docs/network/ — it explains how to set up a proxy for OpenCode. The core issue is that OpenCode cannot reach your proxy, so you’ll need to manually configure some environment variables to resolve this.
I encountered this problem a long time ago.
I was using Windows 11 + WSL, and I was using OpenCoder on Windows at the time.
OpenAI's login callback port is 1415 (this is the case for me).
Solution:
I disabled WSL. That solved the problem. (It seems like a port conflict was the issue.)
If you're running opencode on a remote/headless server (e.g. a VM in Proxmox), neither the browser method nor the headless method may work out of the box. The browser method fails because there's no browser on the server, and the headless/device code flow requires a ChatGPT Enterprise or Edu workspace.
Solution: SSH port forwarding
This only applies to remote installs. If opencode is running on your local machine, just use the browser method normally.
Step 1 — On your local machine, open a terminal and create an SSH tunnel:
ssh -L 1415:localhost:1415 user@your-server-ip
Keep this window open.
Step 2 — In that same SSH session (you're now on the server), start the auth flow:
opencode auth login
Select ChatGPT Pro/Plus (browser). Opencode will output a URL.
Step 3 — Copy that URL and open it in the browser on your local machine. Log in with OpenAI.
Step 4 — OpenAI sends the callback to localhost:1415 on your local machine. The tunnel forwards it to the server automatically. Opencode receives it and authentication completes.
The token is saved on the server, so you only need to do this once. After that, opencode starts normally without the tunnel.
Activity
github-actions commentedon Jan 12, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
risingjerry commentedon Jan 15, 2026
hey bro ,have you alrady solve this problem?
muuufc commentedon Jan 15, 2026
I have the same issue
risingjerry commentedon Jan 15, 2026
I managed to resolve this by enabling TUN mode on my VPN client.
It appears the CLI/Server requires a network-level proxy to correctly handle the OAuth callback.
Works perfectly now!
muuufc commentedon Jan 15, 2026
Thanks for the tip, didn't work for me unfortunately. Tried with vpn off as well and same issue
PerrinYong commentedon Jan 23, 2026
我这边解决了
通过以下方式启动opencode:
原因是OpenCode 去请求 OpenAI 的 OAuth token 端点时,被返回了 403 Forbidden.
浏览器那边登录成功(浏览器吃系统代理)
OpenCode server 进程这边 exchange token 没走系统代理
andyWang1688 commentedon Jan 24, 2026
但是这样登录后也用不了模型啊
R44VC0RP commentedon Jan 24, 2026
@fwang can you follow up on this?
wuxiaohui0 commentedon Jan 26, 2026
Have you solved this problem? Could you please share your solution?
andyWang1688 commentedon Jan 26, 2026
Please refer to the documentation at https://opencode.ai/docs/network/ — it explains how to set up a proxy for OpenCode. The core issue is that OpenCode cannot reach your proxy, so you’ll need to manually configure some environment variables to resolve this.
Nick-Hopps commentedon Feb 3, 2026
我这边开 TUN 没用,设置代理可行=。=
chrishowell commentedon Feb 4, 2026
NODE_TLS_REJECT_UNAUTHORIZED=0 opencode auth login 🥳
(obviously be careful who's MitM'ing you)
DoraemonHugU commentedon Mar 14, 2026
I encountered this problem a long time ago.
I was using Windows 11 + WSL, and I was using OpenCoder on Windows at the time.
OpenAI's login callback port is 1415 (this is the case for me).
Solution:
fmolinam commentedon Apr 16, 2026
dummy
mwisselaar commentedon May 24, 2026
If you're running opencode on a remote/headless server (e.g. a VM in Proxmox), neither the browser method nor the headless method may work out of the box. The browser method fails because there's no browser on the server, and the headless/device code flow requires a ChatGPT Enterprise or Edu workspace.
Solution: SSH port forwarding
This only applies to remote installs. If opencode is running on your local machine, just use the browser method normally.
Step 1 — On your local machine, open a terminal and create an SSH tunnel:
Keep this window open.
Step 2 — In that same SSH session (you're now on the server), start the auth flow:
Select ChatGPT Pro/Plus (browser). Opencode will output a URL.
Step 3 — Copy that URL and open it in the browser on your local machine. Log in with OpenAI.
Step 4 — OpenAI sends the callback to
localhost:1415on your local machine. The tunnel forwards it to the server automatically. Opencode receives it and authentication completes.The token is saved on the server, so you only need to do this once. After that, opencode starts normally without the tunnel.
rekram1-node commentedon Jun 23, 2026
Automated: closing question issues.
GitHub Issues are for bug reports and feature requests only — questions / support are no longer tracked here.
If this is a bug or feature request, please open a new issue with the appropriate template.