Skip to content

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

Closed

Description

@LaurenceGuws

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.

Activity

  1. github-actions commented on Oct 17, 2025

    @github-actions
    Contributor

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

    Powered by Codex Action

  2. LaurenceGuws commented on Oct 20, 2025

    @LaurenceGuws
    Author

    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

  3. Stefanyshyn commented on Oct 24, 2025

    @Stefanyshyn

    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.

  4. lixin-zhao18 commented on Nov 4, 2025

    @lixin-zhao18

    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.

  5. added
    authIssues related to authentication and accounts
    on Nov 15, 2025
  6. lzq4047 commented on Nov 19, 2025

    @lzq4047

    Fixed by changing the SOCKS proxy to an HTTP proxy.

  7. steveepreston commented on Nov 25, 2025

    @steveepreston

    Issue still exists
    The error is on Codex/Openai side

  8. td-shi commented on Nov 25, 2025

    @td-shi

    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.

  9. cnm-vs commented on Nov 25, 2025

    @cnm-vs
    Image

    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.

    Image
  10. xiajiafu888 commented on Dec 3, 2025

    @xiajiafu888

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

  11. steveepreston commented on Dec 4, 2025

    @steveepreston

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

  12. etraut-openai commented on Jan 13, 2026

    @etraut-openai
    Contributor

    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.

  13. steveepreston commented on Jan 15, 2026

    @steveepreston

    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.

  14. SGmuwa commented on Feb 9, 2026

    @SGmuwa

    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:.

  15. xiajiafu888 commented on Feb 9, 2026

    @xiajiafu888

    use socks proxy can solve the problem

  16. yanan1116 commented on Feb 15, 2026

    @yanan1116

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

  17. locked and limited conversation to collaborators on Feb 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    authIssues related to authentication and accountsbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions