Codex Desktop keeps using revoked ChatGPT OAuth token after logout/login
Codex Desktop repeatedly uses revoked ChatGPT OAuth token after logout/login and profile reset
Summary
Codex Desktop can successfully connect to SSH remotes, but Desktop requests to chatgpt.com/backend-api/wham/* continue returning 401 token_expired / 401 token_revoked after full logout/login, local profile reset, CLI auth reset, bundled CLI auth reset, and Desktop restart.
This appears to be a Desktop/web account auth refresh issue rather than an SSH/remote-machine issue.
Environment
- macOS
- Codex Desktop app
- Codex CLI version:
0.142.5 - Bundled Desktop CLI:
/Applications/Codex.app/Contents/Resources/codex - SSH remotes
Observed behavior
After a clean Desktop restart, remote SSH connections succeed:
Immediately afterward, Desktop account/app metadata requests fail:
failed to list apps: Request failed with status 401 Unauthorized:
{
"error": {
"message": "Provided authentication token is expired. Please try signing in again.",
"code": "token_expired"
},
"status": 401
}
Additional requests also fail:
GET https://chatgpt.com/backend-api/wham/accounts/check
401 token_revoked
"Encountered invalidated oauth token for user, failing request"
Thread-title generation also reports:
Your access token could not be refreshed because your refresh token was revoked.
Please log out and sign in again.
Things already tried
- Full Codex Desktop logout/login
- Full Codex Desktop restart
- Reset local Desktop profile/cache:
~/Library/Application Support/Codex~/Library/Caches/Codex~/Library/Caches/com.openai.codex- Reset standalone CLI auth:
codex logoutcodex login --device-auth- Reset bundled Desktop CLI auth:
/Applications/Codex.app/Contents/Resources/codex logout/Applications/Codex.app/Contents/Resources/codex login --device-auth- Verified both local CLIs report:
Logged in using ChatGPT- Verified SSH remotes connect and app-server handshakes succeed.
Expected behavior
After logout/login and fresh device auth, Codex Desktop should stop using the invalidated token and should successfully refresh/reload account/app metadata.
Actual behavior
Codex Desktop continues to make authenticated chatgpt.com/backend-api/wham/* requests with a token the backend considers revoked/expired, even though local CLI auth and bundled CLI auth both report successful login.
4 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Came here from Google, I am getting the same error!
I reproduced what appears to be the same failure with:
26.814.414070.148.0-alpha.15Darwin 27.0.0 arm64 armIn this case, the evidence strongly suggests a stale in-memory credential after a shared credential-store rotation:
app-serverremained running.app-server/ CLI authentication flow was also running, and both clients used the file-backed~/.codex/auth.jsonstore.refresh_token_invalidated; Desktop changed from an authenticated account being present to no authenticated account and logged out.Sanitized log sequence from one occurrence:
Recovery/workaround that has remained stable:
cli_auth_credentials_store = "keyring"in~/.codex/config.toml.app-server, leaving only the Desktop-owned process.~/.codex/auth.jsonis gone.After that, repeated thread switches and a completed probe turn did not produce
refresh_token_invalidated, and the account remained signed in. Auth, network, and WebSocket diagnostics also passed.Because changing the credential store and removing the second process were done together, this does not prove which change is individually sufficient. It does narrow the likely failure mode to multi-client credential rotation plus stale in-memory auth.
Expected behavior:
app-servershould reload the current credential after another Codex client logs in or refreshes it.No account IDs, tokens, callback URLs, or unredacted logs are included here.
Correction to my earlier diagnostic comment above: the multi-client credential-rotation / Keychain workaround was not durable, and that causal attribution should be treated as retracted.
A later controlled reproduction on Desktop
26.818.21641(build6849) showed the exact trigger:/backend-api/accounts/:account/settingsfor a personal paid account.hasToken=false,nullReason=auth_token_missing, while still reportingrefreshToken=true.Cmd+Qand reopen restored the account without a new OAuth login.The failure recurred despite the earlier credential-store/process changes and despite disabling Remote Control, Computer History/Chronicle, Advanced Account Security changes, and the ChatGPT Chrome extension. A same-machine rollback to signed build
26.810.52044removed the settings request and survived repeated Codex-task and ChatGPT-chat switches with no auth drop.The canonical match is now #39162, where I posted the newer-build failure timeline and rollback A/B evidence: https://github.com/openai/codex/issues/39162#issuecomment-5353505977
This may still share auth-state symptoms with this issue, but the evidence no longer supports my earlier claim that a competing client was the root cause in this incident.