Linux: Token exchange failed: error sending request for url (https://auth.openai.com/oauth/token)

Resolved 💬 15 comments Opened Oct 17, 2025 by LaurenceGuws Closed Jan 13, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

codex-cli 0.46.0

What subscription do you have?

PLUS

Which model were you using?

gpt-5-codex

What platform is your computer?

Linux 6.17.1-arch1-1 x86_64 unknown (Arch linux)

What issue are you seeing?

GET
http://localhost:1455/auth/callback?code=redacted&scope=openid profile email offline_access&state=redacted
Status
500
Internal Server Error
VersionHTTP/1.1
Transferred252 B (90 B size)
Referrer Policystrict-origin-when-cross-origin
Request PriorityHighest
DNS ResolutionSystem

What steps can reproduce the bug?

When I started using codex cli, it worked fine for like 2 hours max, then I'd get errors from openapi responses.
The solution for this was to delete "rm -rf ~/.codex" and relogin with the cli.

But now this also does not work. I am not able to log in at all anymore.
I always get the token exchange error no matter what (different linux machines, browsers, terminals etc.) I try.

What is the expected behavior?

Redirect to the CLI with proper auth tokens, not throw 500 error.

Additional information

I tried with
Kitty terminal, Zen browser
Chromium
VSCodium
Ghostty
Disabled UFW
Checked internet connectivity.
Setting DNS to 8.8.8.8
Ensuring no VPN or other IP link is active(besides Ethernet cable)

Nothing works.

View original on GitHub ↗

15 Comments

github-actions[bot] contributor · 9 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #5221
  • #3409

Powered by Codex Action

LaurenceGuws · 9 months ago

I figured out what's causing the issue.
If I enable/disable wireguard client, I need to reboot my system before I can use the cli again.
Not sure why this is the case as I'm able to ping the domain

Stefanyshyn · 8 months ago

I had the same issue on WSL. What worked for me was opening the console, installing Codex globally, running it once, logging in, and then restarting Windows in VS Code — after that, everything started working fine.

zhao926777 · 8 months ago

To fix the Token exchange failed error, you must launch VS Code with explicit proxy settings and a crucial bypass list, ensuring external OpenAI traffic goes through the proxy while local authentication callbacks remain direct.

lzq4047 · 8 months ago

Fixed by changing the SOCKS proxy to an HTTP proxy.

steveepreston · 7 months ago

Issue still exists
The error is on Codex/Openai side

td-shi · 7 months ago

I came here with the same problem.
For reference:

  • Ubuntu 24.04
  • uname -s -o -r -m : Linux 6.14.0-35-generic x86_64 GNU/Linux
  • LXTerminal 0.40.0
  • python 3.12.3
  • nvm 0.40.3
  • node 24.11.1 (npm 11.6.2)
  • codex-cli 0.63.0
  • Not using a proxy or VPN.

I tried rm -rf ~/.codex, ufw allow 1455/tcp, downgrading the node to 18, and reinstalling modules certifi and requests in Python,
but the Codex (login) does not work.

cnm-vs · 7 months ago

<img width="307" height="299" alt="Image" src="https://github.com/user-attachments/assets/24b43471-c438-4289-ba2d-625fc6f1ce79" />

I have resolved the issue.

In Codex, when I press the Enter key on the screen above, it is registered twice.
If the screen above appears again, please press the Enter key once more.

When the screen switches to the one below, try logging in at that moment.
It seems that only at this point the web browser correctly receives the login information.

<img width="540" height="287" alt="Image" src="https://github.com/user-attachments/assets/93e8057d-9651-4274-984c-7e4e8fbdb251" />

xiajiafu888 · 7 months ago

I'm chinese,I have the same issue.I'm ubuntu22.04,please help me.
我遇到同样的问题了,有兄弟解决了吗

steveepreston · 7 months ago

one the reasons in Windows was enabling WSL mode
there is no response from openai

etraut-openai contributor · 6 months ago

Closing old bug.

If you're having problems with our normal interactive auth flow for some reason (e.g. a local firewall or other network settings), you can try using the headless device authentication techniques.

steveepreston · 6 months ago

In the file C:\Users\{User}\.codex\config.toml
Make sure this is set: windows_wsl_setup_acknowledged = false
if it's true then login will not works.

SGmuwa · 5 months ago
To fix the Token exchange failed error, you must launch VS Code with explicit proxy settings and a crucial bypass list, ensuring external OpenAI traffic goes through the proxy while local authentication callbacks remain direct.

I added localhost, ::1 and 127.0.0.1 to the "Http: No Proxy" setting, but the problem still occurs. Disabling the proxy didn't help either. Could you please tell me which addresses you added? @zhao926777

In the devtools i see the error:

A networking error occurred during POST request to https://ab.chatgpt.com/v1/rgstr?k=client-REDACTED&st=javascript-client-react&sv=3.27.0&t=REDACTED&sid=REDACTED&ec=REDACTED Invalid URL protocol: the URL must start with http: or https:.

xiajiafu888 · 5 months ago

use socks proxy can solve the problem

yanan1116 · 5 months ago

Token exchange failed: error sending request for url (https://auth.openai.com/oauth/token) still facing this issue.