Codex CLI login fails on Windows: auth.openai.com reachable via curl but OAuth/device-auth fail
OpenAI Developer Community
May 26, 2026
Thanks for the detailed writeup, and good call from @Vultieris too.
This does look more like the CLI is getting blocked or redirected during the auth request, especially with the Unexpected token '<' hint. That usually means something expected JSON but got an HTML page back instead.
Since PowerShell can reach the endpoint, I’d next try:
- Run
codex login --device-authfrom a clean PowerShell session - Temporarily disable VPN, antivirus web filtering, DNS filtering, and corporate/security proxy tools
- Try the same login from WSL or another Windows user profile
- Test on a different network, like mobile hotspot
API key login is probably the best workaround for now. Sanitized CLI debug logs would be useful, but definitely do not share auth.json, cookies, tokens, or keys.
-Mark G.
Discussion in the ATmosphere