Unable to use codex at all – neither via API keys nor via web login
Resolved 💬 7 comments Opened Sep 10, 2025 by rr- Closed Sep 10, 2025
What version of Codex is running?
codex-cli 0.31.0
Which model were you using?
codex-mini-latest
What platform is your computer?
Linux 6.15.9-arch1-1 x86_64 unknown
What steps can reproduce the bug?
WEB LOGIN
- Run codex
- Sign in with ChatGPT
- (See the link opened in the browser, OR click it manually, both lead to the same outcome)
- Log in with Google
- Redirects go brrr
Token exchange failed: error sending request for url (https://auth.openai.com/oauth/token). The CLI continues to wait for a confirmation which never arrives.
<img width="1433" height="270" alt="Image" src="https://github.com/user-attachments/assets/eddef43c-f6dc-480d-b35e-a163a44c48fe" />
API LOGIN
- Set
OPENAI_API_KEYeither toOPENAI_API_KEY=sk-proj-…orOPENAI_API_KEY=sk-mym… - Launch codex
- Use
preferred_auth_method="apikey"inconfig.tomlOR confirm that yes I want to use pay as I go payment method associated with API keys - Prompt "test"
- Wait around 30 s
⚠️ stream error: error sending request for url (https://api.openai.com/v1/responses); retrying 1/5 in 188ms…
What is the expected behavior?
I can use Codex
What do you see instead?
Currently I'm not able to use Codex in any way
Additional information
_No response_
7 Comments
ISP issue on my part. Changing my DNS to 8.8.8.8 fixed the issue. Found this out with the help of
tcpdump.lol the same, has nothing to do with this OAuth shit
Thanks @rr- ,
It’s working as expected for me. If you’re facing issues, please ensure that port 443 is open on your system.
Issue still exists and not resolved by setting DNS or opening 443 port
Update: Resolved by turning off the WSL mode
maybe your system env is wrong.
I solved the problem, because of some reasons in China, we cannot use the full Internet, after I open the TUN mode of my clash Verge, codex login succeeded and works fine, thanks for that
Also have this issue. I use Happ app, and selecting TUN mode in a client helps me resolve this one
<img width="1034" height="668" alt="Image" src="https://github.com/user-attachments/assets/f34b9848-bfdf-4d46-973c-80421a352acf" />