vscode connected to wsl can not sign-in
Resolved 💬 15 comments Opened Oct 1, 2025 by twinrise Closed Jan 13, 2026
What version of Codex is running?
latest
Which model were you using?
gpt-4.1
What platform is your computer?
wsl
What steps can reproduce the bug?
My VS Code is connected to the VS Code Server on WSL. After installing the Codex plugin, when I try to log in, the browser opens the login page. After I log in, it can’t redirect back to the plugin. This seems to happen because the authorization callback URL is generated inside WSL and uses localhost. After logging in, the browser tries to call back to localhost to notify the plugin of success, but it fails since it points to the WSL host. Can this bug be fixed? Or could you implement the same authorization approach as Claude Code?
What is the expected behavior?
when i login in browser, should notify codex plugin, and can do work in plugin
What do you see instead?
_No response_
Additional information
_No response_
15 Comments
I also have this issue with attempting to log in to codex running on a remote headless server. I enter in the url in browser, log into openai, but it times out. There should be way to login when the machine the web browser is on is not the machine codex is running on.
i meet the same issue
2025-10-12 21:09:54.539 [error] Error fetching https://ab.chatgpt.com/v1/rgstr?k=client-sYWqzCYMRkUg4DqqiZcR5DGTNl2iD7zNJY0HoeDLzxR&st=javascript-client-react&sv=3.25.5&t=1760274592504&sid=a61a839f-fdc3-4143-9144-17a8eff3ff28&ec=1001&gz=1: TypeError: fetch failed
2025-10-12 21:09:55.983 [error] CLI: Token exchange error: error sending request for url (https://auth.openai.com/oauth/token)
<img width="1704" height="307" alt="Image" src="https://github.com/user-attachments/assets/7b18c583-345b-496b-970f-4b31e78c0802" />
I was having the same issue, suddenly, after it had been working fine for a few days.
I asked ChatGPT. It said I could try adding the following in my devcontainer.json:
No idea why it stopped working. I think it was when I tried using Codex in a second container.
Fixed the same issue by ensuring the WSL network works in the mirrored mode.
I fix this buy follow steps:
1、shutdown wsl2 :this works for vscode、windsurf and cursor
vscode if you do this
<img width="1266" height="213" alt="Image" src="https://github.com/user-attachments/assets/597a5a3c-000c-44c3-9247-d740f33375ad" />
<img width="1347" height="576" alt="Image" src="https://github.com/user-attachments/assets/28cdec01-33ef-488f-a9d8-ce6324c3003b" />
<img width="2337" height="804" alt="Image" src="https://github.com/user-attachments/assets/fbbfa5df-1a7b-4881-b9bf-2880800b0938" />
in settins.json file turn off the wsl2 as follows:
in cursor setting as vscode
<img width="1932" height="735" alt="Image" src="https://github.com/user-attachments/assets/7203a11d-a125-477f-95b6-4b8eea474210" />
in windsurf
<img width="1314" height="366" alt="Image" src="https://github.com/user-attachments/assets/106acb98-9410-4d87-aff9-22f8ad8746b4" />
2、then login you can fix this rember do not turn on wsl ,do not turn on
<img width="429" height="744" alt="Image" src="https://github.com/user-attachments/assets/2ee61b8c-d0b9-4e86-ae0f-ec6526c6db7b" />
I was able to fix this issue with the following steps
(assuming you already have the WSL extension installed in VS Code):
$env:USERPROFILE\.codex\auth.jsonOpen that file and copy its JSON contents.
mkdir -p ~/.codex
nano ~/.codex/auth.json
Paste the JSON you copied from Windows and save the file.
code .from your Linux terminal). Codex should be authenticated and working correctly.您好,您的邮件我已经收到,我会尽快处理
it works!
您好,您的邮件我已经收到,我会尽快处理
您好,您的邮件我已经收到,我会尽快处理
shutdown wsl2 :this works for vscode、windsurf and cursor
This Method works for me . Thx~!
modify a little.
1-2、same
3、notepad $env:USERPROFILE\.codex\auth.json
4、mkdir -p ~/.codex vi ~/.codex/auth.json
5、the same
it works +1
您好,您的邮件我已经收到,我会尽快处理
It’s not working for me. It keeps showing “Reconnecting...”
您好,您的邮件我已经收到,我会尽快处理