Codex Desktop OAuth login failure - CLI works but Desktop fails

Resolved 💬 4 comments Opened May 29, 2026 by GiovannyPonte Closed May 29, 2026

What version of the Codex App are you using (From “About Codex” dialog)?

26.519.11010.0

What subscription do you have?

ChatGPT Pro

What platform is your computer?

Windows 10 Pro Version 2009 Build 10.0.26100.1 64-bit

What issue are you seeing?

Codex Desktop cannot complete authentication.

Error:

token_exchange_failed

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

Codex Desktop version:
26.519.11010.0

Codex CLI version:
0.135.0

Important:

Codex CLI works correctly on the same machine, same account, same network, and same operating system.

Only Codex Desktop fails during OAuth token exchange.

Diagnostic steps already performed:

"Invalid method for URL (GET /oauth/token)"

  • localhost:1455 OAuth callback is functioning.
  • No WinHTTP proxy is configured.
  • System date and time are correct.
  • Kaspersky antivirus disabled.
  • HTTPS inspection disabled.
  • Codex Desktop cache cleared.
  • WebView2 processes restarted.
  • Codex Desktop reinstalled.

Expected behavior:
Codex Desktop should authenticate successfully.

Actual behavior:
Authentication fails with token_exchange_failed during OAuth token exchange.

What steps can reproduce the bug?

  1. Open Codex Desktop 26.519.11010.0.
  2. Click "Continue with ChatGPT".
  3. Browser opens and authentication completes successfully.
  4. Codex Desktop returns:

token_exchange_failed

  1. Login never completes.

Frequency:
100% reproducible.

What is the expected behavior?

Codex Desktop should successfully authenticate using the "Continue with ChatGPT" workflow.

After completing authentication in the browser, Codex Desktop should receive the OAuth token, complete the token exchange, sign the user in, and open the application normally.

The same account already authenticates successfully using Codex CLI 0.135.0 on the same machine, network, and operating system.

Additional information

Additional diagnostic information:

  • Codex Desktop version: 26.519.11010.0
  • Codex CLI version: 0.135.0
  • Subscription: ChatGPT Pro
  • Windows 10 Pro x64 (Build 10.0.26100.1)

Results of troubleshooting:

  • Codex CLI authenticates and works correctly.
  • Browser authentication works correctly.
  • Chrome and Microsoft Edge both reproduce the issue.
  • localhost:1455 OAuth callback is functioning.
  • auth.openai.com is reachable.
  • Invoke-WebRequest https://auth.openai.com/oauth/token returns the expected response:

"Invalid method for URL (GET /oauth/token)"

  • No WinHTTP proxy configured.
  • System date and time verified.
  • Kaspersky antivirus disabled during testing.
  • HTTPS inspection disabled.
  • Codex Desktop cache cleared.
  • WebView2 processes restarted.
  • Codex Desktop reinstalled.

The issue appears isolated to Codex Desktop OAuth token exchange. The same account works successfully with Codex CLI on the same machine.

<img width="234" height="161" alt="Image" src="https://github.com/user-attachments/assets/52ad244d-defd-4e42-b16d-86a3e60e0281" />

View original on GitHub ↗

4 Comments

GiovannyPonte · 3 months ago

Additional diagnostic information from codex doctor:

Environment:

  • Codex Desktop: 26.519.11010.0
  • Codex CLI: 0.135.0
  • Windows 11 Pro (Build 26200)
  • ChatGPT Pro

Results:

  • No proxy configured.
  • OpenAI endpoints reachable over HTTPS.
  • Browser authentication works.
  • localhost OAuth callback is functioning.
  • Codex CLI authenticates and works successfully.
  • Invoke-WebRequest https://auth.openai.com/oauth/token reaches the endpoint and returns the expected:

"Invalid method for URL (GET /oauth/token)"

Desktop App still fails with:

token_exchange_failed

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

Additional troubleshooting already performed:

  • Chrome and Edge both reproduce the issue.
  • Kaspersky antivirus disabled.
  • HTTPS inspection disabled.
  • Codex Desktop cache cleared.
  • WebView2 processes restarted.
  • Codex Desktop reinstalled.

The same account, machine, network, and operating system work correctly with Codex CLI 0.135.0.

This appears isolated to Codex Desktop OAuth authentication.

GiovannyPonte · 3 months ago

Update: The issue appears to be resolved after updating Codex Desktop.

Previous version:
26.519.11010.0

Current version:
26.527.3378.0

After updating to 26.527.3378.0, authentication completed successfully and Codex Desktop is now working normally.

Why I originally suspected a Codex bug:

  • Codex CLI 0.135.0 worked correctly on the same machine, account, network, and operating system.
  • Browser authentication worked correctly.
  • OAuth localhost callback worked correctly.
  • OpenAI endpoints were reachable.
  • No proxy was configured.
  • Antivirus and HTTPS inspection were disabled during testing.
  • codex doctor did not identify any critical connectivity failures.

Because the same environment worked correctly with Codex CLI but consistently failed with Codex Desktop 26.519.11010.0, the evidence pointed toward a Desktop-specific issue rather than a local network or operating system problem.

The problem disappeared immediately after upgrading to Codex Desktop 26.527.3378.0, suggesting the issue was likely caused by a bug or regression in the previous Desktop build.

Thank you for the assistance.

fanstyneed · 2 months ago

I have encountered the same issue.

However, my current version is 26.601.21317, and I still have not been able to resolve it.

445021381ad999-max · 1 month ago

Resolved in my case. The root cause was a stale per-user proxy environment variable, not the Codex app itself.

My browser worked normally because it used the Windows system proxy, but Codex inherited old environment variables:

HTTP_PROXY=http://127.0.0.1:6850
HTTPS_PROXY=http://127.0.0.1:6850

Port 6850 was no longer listening. My actual proxy client was listening on 127.0.0.1:7892. Because Codex was trying to use the dead port, it failed with:

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

Before the login failure, I also saw repeated streaming errors:

stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses)

What fixed it

  1. Find the proxy client's real listening port:
netstat -ano | findstr LISTENING
  1. Check proxy-related environment variables:
Get-ChildItem Env: | Where-Object Name -Match 'PROXY'
[Environment]::GetEnvironmentVariable("HTTP_PROXY", "User")
[Environment]::GetEnvironmentVariable("HTTPS_PROXY", "User")
  1. Update the stale values to the proxy client's actual port, or remove them if you want Codex to rely on the Windows system proxy. Example only — replace 7892 with your own real port:
setx HTTP_PROXY "http://127.0.0.1:7892"
setx HTTPS_PROXY "http://127.0.0.1:7892"

To remove stale user variables instead:

[Environment]::SetEnvironmentVariable("HTTP_PROXY", $null, "User")
[Environment]::SetEnvironmentVariable("HTTPS_PROXY", $null, "User")
[Environment]::SetEnvironmentVariable("ALL_PROXY", $null, "User")
  1. Fully terminate every ChatGPT.exe and codex.exe process, then start the app again. Environment-variable changes only apply to newly started processes.

After correcting the port and restarting all Codex/ChatGPT processes, both OAuth login and streaming worked immediately.

This is worth checking especially when browser login works but the Windows desktop app fails, and reinstalling the app does not help, because user environment variables survive an app reinstall.