Codex Desktop for Windows – authentication loop after opening local project
What version of the Codex App are you using (From “About Codex” dialog)?
26.818.61809
What subscription do you have?
Pro
What platform is your computer?
Microsoft Windows NT 10.0.19045.0 x64
What issue are you seeing?
I am experiencing a persistent authentication loop in Codex Desktop on Windows.
Authentication succeeds in the browser and Codex returns to the application normally. However, as soon as I open a local project/folder, Codex loses authentication and asks me to sign in again. Re-authenticating repeats the same loop.
I have tested:
Passkey authentication and non-passkey authentication
Removing OPENAI_API_KEY temporarily from Windows environment variables
Updating Codex Desktop to the latest available version
Multiple local folders
The problem persists.
The important diagnostic point is that Codex CLI works correctly on the same Windows machine, with the same account and the exact same project folder:
E:\Projets\Test
Codex CLI v0.149.1 authenticates automatically and remains connected.
Desktop logs show:
desktop_fetch_auth_401 hadToken=true
followed immediately by:
hasToken=false nullReason=auth_token_missing refreshToken=true tokenExpiryState=missing
and then:
Missing valid access token or actor biscuit
with HTTP 401 responses on:
/backend-api/accounts/.../settings
and /backend-api/wham/...
Example sequence:
desktop_fetch_auth_401 hadToken=true ... status 401
then:
auth_status_result ... hasToken=false nullReason=auth_token_missing refreshToken=true
This strongly suggests that the Windows Desktop client is losing or failing to attach the ChatGPT authentication token after receiving the first 401, while the underlying Codex authentication remains valid because CLI continues working.
Environment:
Windows x64
Codex Desktop originally affected on 26.818.61809, still affected after update
Codex CLI v0.149.1 works normally
ChatGPT account authentication itself works normally
I can provide the full Codex Desktop log if needed.
What steps can reproduce the bug?
Steps to reproduce
Launch Codex Desktop on Windows.
Sign in with my ChatGPT/OpenAI account. Authentication succeeds in the browser and returns to Codex Desktop.
Open/select a local project folder, for example:
E:\Projets\Test
Codex Desktop immediately loses the authenticated state and asks me to sign in again.
Sign in again successfully.
Return to Codex Desktop and select/open the local folder again.
The same authentication prompt appears again, creating an infinite authentication loop.
Expected behavior
After successful authentication, Codex Desktop should remain signed in and open the local project normally.
Actual behavior
Codex Desktop repeatedly loses authentication after opening the local project and asks me to sign in again.
Important diagnostic information
The same account and the same project work correctly in Codex CLI on the same Windows machine:
OpenAI Codex v0.149.1
directory: E:\Projets\Test
The CLI authenticates automatically and stays connected, so the issue appears to be specific to Codex Desktop.
Desktop logs show the following sequence:
desktop_fetch_auth_401 hadToken=true
followed immediately by:
hasToken=false nullReason=auth_token_missing refreshToken=true tokenExpiryState=missing
and then:
Missing valid access token or actor biscuit
with HTTP 401 responses on account/settings endpoints.
Environment / recent account changes
I am not sure which of these changes is related to the issue, but shortly before the problem I made several account/authentication changes:
I purchased/created an OpenAI API key.
I added OPENAI_API_KEY as a Windows system environment variable.
I later removed it temporarily for testing, but the issue still occurred.
I changed my authentication method.
I added a passkey.
I changed my password.
I also tested signing in without the passkey, but the issue still occurred.
Because several authentication-related changes happened close together, I cannot determine which one, if any, triggered the issue.
Versions tested
Codex Desktop: originally reproduced on 26.818.61809
Still reproducible after updating Codex Desktop
Codex CLI: v0.149.1 works correctly
Session ID / usage / context
I do not currently have a session ID associated with the failed Desktop authentication loop.
The failure occurs immediately when opening the local project, before doing meaningful work in the session.
Token-limit usage and context-window usage do not appear applicable to the reproduction, because the authentication failure happens before a normal Codex interaction starts.
What is the expected behavior?
Expected behavior:
After successfully signing in to my OpenAI/ChatGPT account, Codex Desktop should remain authenticated and allow me to open and work in a local project folder without asking me to sign in again.
The authentication session should persist normally, as it currently does with Codex CLI on the same computer, using the same account and the same local project.
Additional information
Additional information:
The issue appears to be specific to Codex Desktop on Windows.
Codex CLI v0.149.1 works correctly on the same machine, with the same OpenAI/ChatGPT account and the exact same local project folder. The CLI authenticates automatically and remains signed in.
The Desktop logs show a consistent authentication failure sequence:
desktop_fetch_auth_401 hadToken=true
Immediately afterwards:
hasToken=false nullReason=auth_token_missing refreshToken=true tokenExpiryState=missing
Then subsequent requests fail with:
Missing valid access token or actor biscuit
This suggests that Codex Desktop initially has an authentication token, receives a 401 response, and then loses or stops attaching the token even though a refresh token is present.
I also tested the following without resolving the issue:
- Updated Codex Desktop to the latest available version.
- Signed in using a passkey.
- Signed in without using the passkey.
- Temporarily removed my OPENAI_API_KEY Windows environment variable.
- Restarted Codex and authenticated again.
Recent account changes that may or may not be related:
- I created/purchased an OpenAI API key.
- I added a passkey to my account.
- I changed my password.
- I changed authentication-related settings.
I cannot determine whether any of these changes triggered the problem.
The important distinction is that authentication still works correctly in Codex CLI, while Codex Desktop enters an infinite sign-in loop.
I can provide the full Codex Desktop logs if needed.
3 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I’m seeing a related Windows Codex Desktop failure that began with an authentication/sign-in loop, but then progressed into intermittent conversation creation/continuation failures (
Conversation creation failed – Timeoutandno rollout found for thread id ...). I opened #40704 with the full environment, reproduction sequence, and troubleshooting details. This may share the same underlying auth/session-state problem, but in my case it also appears to corrupt or lose thread/rollout state after authentication recovers.Workaround found / additional diagnostic information
I was able to reproduce and partially work around this issue on Windows.
Observed behavior
Codex Desktop initially starts authenticated and is usable.
The authentication is lost when opening a Codex/ChatGPT conversation.
The Desktop logs show the following sequence:
desktop_fetch_auth_401 hadToken=true
followed immediately by:
hasToken=false
nullReason=auth_token_missing
refreshToken=true
tokenExpiryState=missing
Subsequent requests then fail with:
Missing valid access token or actor biscuit
Important finding
I monitored the local Codex files before and after reproducing the authentication failure.
The following file is modified when the failure occurs:
%USERPROFILE%\.codex\auth.json
I made a backup of auth.json while Codex Desktop was successfully authenticated.
After reproducing the authentication loop:
Close Codex Desktop.
Restore the previously working auth.json.
Restart Codex Desktop.
Codex Desktop is immediately authenticated again without requiring a new login.
This was reproducible.
CLI comparison
Codex CLI continues to work correctly on the same machine, with the same account and project:
OpenAI Codex v0.149.1
The CLI remains authenticated while Desktop enters the authentication loop.
Temporary watchdog workaround
As an experiment, I created a PowerShell watchdog that monitors the Codex Desktop logs for:
nullReason=auth_token_missing
When detected, the workaround:
This successfully restores the Desktop session automatically and has allowed Codex Desktop to remain usable despite the bug.
I initially tried restoring auth.json without restarting Desktop. This only worked temporarily. Restarting the Desktop process after restoring the file appears necessary, presumably because Desktop has already cached the unauthenticated state in memory.
Security warning
Do not share or publish auth.json or a backup of it. It contains authentication credentials.
The workaround should also be considered experimental. A permanently saved authentication file will eventually expire, and blindly restoring auth.json could interfere with legitimate token refreshes.
Possible area to investigate
Based on the observed sequence, Desktop appears to:
have a token
→ receive HTTP 401
→ transition to auth_token_missing
→ modify auth.json
→ remain unauthenticated in memory
while the CLI authentication remains functional.
This may help narrow the issue to the Desktop client's handling of the authentication state following the initial 401.