Token exchange failed: token endpoint returned status 403 Forbidden

Open 💬 6 comments Opened Feb 3, 2026 by 1AoB
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

0.4.69

What subscription do you have?

Token exchange failed: token endpoint returned status 403 Forbidden

Which model were you using?

_No response_

What platform is your computer?

_No response_

What terminal emulator and version are you using (if applicable)?

_No response_

What issue are you seeing?

Unable to log in, error reported:Token exchange failed: token endpoint returned status 403 Forbidden

What steps can reproduce the bug?

login

What is the expected behavior?

_No response_

Additional information

_No response_

View original on GitHub ↗

6 Comments

github-actions[bot] contributor · 5 months ago

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

  • #8158

Powered by Codex Action

etraut-openai contributor · 5 months ago

Please use the /feedback slash command to upload your logs after attempting to log in, then post your thread ID here.

UnCrownGod · 5 months ago

Hi Community, I have a solution for this bug

OS: Ubuntu 20.04
VS Code: APT / .deb version
Browser: Firefox
Network: Optional proxy via Clash Verge
Issue: VS Code Codex login fails
Token exchange failed: token endpoint returned status 403 Forbidden

FIX:

Ensure localhost never goes through proxy

{export NO_PROXY=127.0.0.1,localhost,::1}

If using proxy (Clash / V2Ray), use HTTP port (example 10809)

{
export http_proxy=http://127.0.0.1:10809/
export https_proxy=http://127.0.0.1:10809/
}

VS Code settings.json

{
"http.proxy": "http://127.0.0.1:10809/",
"http.noProxy": "127.0.0.1,localhost,::1",
"http.proxySupport": "override"
}

Browser
Use system proxy
Under Settings -- Network Settings -- Use system proxy settings -- No proxy for
{localhost, 127.0.0.1}

You may noticed that after you re-open your pc, the vscode can not be opened properly, for everytime you wanna open your vscode, type
{code --disable-layout-restore --user-data-dir /tmp/vscode-fix &
}

I haven't fix this issue yet

1AoB · 5 months ago

@UnCrownGod Thanks a lot!

suesunss · 5 months ago

same issue here

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

chenzhaoqiJM · 14 days ago

Running export all_proxy=socks5://127.0.0.1:7897/ solved my problem; the environment variable had previously defaulted to all_proxy=socks://127.0.0.1:7897/.