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
codex login and codex login --device-auth both fail with token_exchange_failed. Cloudflare's WAF is issuing a JavaScript challenge (cf-mitigated: challenge) on auth.openai.com, which the CLI's HTTP client cannot solve. This effectively makes the Codex CLI unusable without API key auth.
Error logging in with device code: error sending request for url (https://auth.openai.com/api/accounts/deviceauth/usercode)
Root Cause
curl -I https://auth.openai.com returns HTTP 403 with cf-mitigated: challenge — Cloudflare is serving a JavaScript challenge page ("Just a moment...") to non-browser clients. The Codex CLI's Rust HTTP client cannot solve this challenge, so the OAuth token exchange and device auth endpoints are unreachable.
The browser OAuth redirect (step 1-3) works fine, but the server-to-server token exchange (step 4, CLI → auth.openai.com/oauth/token) is blocked by the challenge.
Environment
CLI version: codex-cli 0.117.0
OS: Arch Linux (kernel 6.19.6)
Region: Melbourne, Australia (cf-ray: *-MEL)
Install method: npm (~/.npm-global/bin/codex)
Reproduction
codex logout
codex login → fails with token_exchange_failed
codex login --device-auth → fails with same error
curl -I https://auth.openai.com → returns 403 with cf-mitigated: challenge
What I've ruled out
Happens on multiple networks (home and office) — not network-specific
Happens with Cloudflare WARP stopped (sudo systemctl stop warp-svc)
I have the same issue. Getting cf-mitigated: challenge on Linux machine. Other machines from the same network work fine. Pausing my subscription in the meantime that this gets ironed out.
that make local requests to domains of auth.openai.com chatgpt.com to be proxied locally before sent to the OpenAI server, it use uTLS project under the hood so it can sent the proxied request with chrome fingerprint
it make me to do codex sessions without using WARP, but i do not logout and relogin at the moment
Activity
github-actions commentedon Mar 27, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
ChocolatePancake commentedon May 23, 2026
I have exactly the same issue. I am using two different proxy vps servers to login to codex. It used to work perfectly fine for the last three months
Update: I checked two more ip addresses, they all get challenged by cloudflare. All the ip addresses are clean. Please fix it
mastazi commentedon Aug 31, 2026
I have the same issue. Getting
cf-mitigated: challengeon Linux machine. Other machines from the same network work fine. Pausing my subscription in the meantime that this gets ironed out.unixapple commentedon Sep 13, 2026
this is annoying and i managed to use cloudflare warp to be able to login but its a bit slow.
so i vibed a project utlsproxy
that make local requests to domains of auth.openai.com chatgpt.com to be proxied locally before sent to the OpenAI server, it use uTLS project under the hood so it can sent the proxied request with chrome fingerprint
it make me to do codex sessions without using WARP, but i do not logout and relogin at the moment