Skip to content

Windows Desktop loses access token and returns to login after /accounts/{account_id}/settings 401 #40374

Open

Description

@amazyzhou1994

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

26.818.5345.0

What subscription do you have?

ChatGPT Plus

What platform is your computer?

Microsoft Windows NT 10.0.19045.0 x64

What issue are you seeing?

The Codex Desktop app on Windows successfully signs in with my ChatGPT account and initially works normally.

However, as soon as I open an existing conversation or send a new prompt, the app returns to the ChatGPT login screen within a few seconds.

This does not appear to be a normal application crash. The ChatGPT/Codex processes remain running. Instead, the Desktop authentication state changes from authenticated to unauthenticated.

The issue is highly reproducible.

The Desktop logs show the following sequence:

1. The account is initially authenticated successfully:

[chatgpt-account-lookup] completed
authenticatedAccountPresent=true
authMethod=chatgpt
result=succeeded

2. A few seconds later, the Desktop sends:

GET https://chatgpt.com/backend-api/accounts/:param/settings

and receives HTTP 401 even though a token is present:

desktop_fetch_auth_401
hadToken=true
tokenSource=cached
willRetry=true

3. Immediately afterwards, the authentication state changes to:

app_server_connection.auth_status_result
authMethod=chatgpt
hasToken=false
nullReason=auth_token_missing
refreshToken=true
tokenExpiryState=missing

4. Account lookup then fails:

[chatgpt-account-lookup] completed
authenticatedAccountPresent=false
authMethod=chatgpt
failureType=account_info_token_unavailable
result=failed

5. The account settings request reports:

Missing valid access token or actor biscuit
status=401
routePattern=/accounts/{account_id}/settings

6. Subsequent requests fail with:

desktop_fetch_auth_401
hadToken=false
skipRetryReason=no_token_attached

and:

Unauthorized - Access token is missing

The UI then returns to the ChatGPT login screen.

The same sequence has reproduced multiple times.

ChatGPT Web continues to work normally with the same account.

Codex CLI also remains logged in:

codex login status
→ Logged in using ChatGPT

I also tested a real CLI model request:

codex exec --skip-git-repo-check "Reply with exactly: CODEX_AUTH_OK"

The WebSocket transport initially receives HTTP 403, but Codex CLI falls back to HTTPS and successfully completes the request:

CODEX_AUTH_OK

Therefore, the ChatGPT account itself is still valid and authenticated. The failure appears specific to the Windows Desktop authentication/token state.

What steps can reproduce the bug?

  1. Launch Codex Desktop on Windows.

  2. Sign in successfully using a ChatGPT account.

  3. Wait until the Codex Desktop home screen loads normally.

  4. Open any existing conversation.

    Alternatively, start a new conversation and send any prompt.

  5. Within a few seconds, Codex Desktop returns to the ChatGPT login screen.

  6. Sign in again.

  7. Open a conversation or send another prompt.

  8. The app returns to the login screen again.

The issue is highly reproducible.

I reproduced it multiple times and observed the same authentication sequence in the Desktop logs:

authenticatedAccountPresent=true
→ /accounts/{account_id}/settings returns HTTP 401 with hadToken=true
→ hasToken=false
→ nullReason=auth_token_missing
→ refreshToken=true
→ authenticatedAccountPresent=false
→ failureType=account_info_token_unavailable
→ Desktop returns to login screen

No special prompt is required. Simply opening an existing conversation is sufficient to reproduce the issue.

What is the expected behavior?

After successfully signing in, Codex Desktop should remain authenticated.

Opening an existing conversation or sending a new prompt should not invalidate or remove the Desktop access token.

If an authenticated request temporarily returns HTTP 401, the Desktop app should refresh or recover the authentication state when a valid refresh token is still available instead of changing the account state to unauthenticated and returning the user to the login screen.

Additional information

Additional observations:

- Codex Desktop version: 26.818.5345.0
- Codex CLI version: 0.149.0
- Authentication method: ChatGPT
- ChatGPT Plus account
- Advanced Account Security is NOT enabled
- ChatGPT Web works normally with the same account
- Codex CLI remains logged in
- Codex CLI can successfully complete an authenticated model request over HTTPS
- Reinstalling / resetting the Windows Desktop app did not resolve the issue
- Rebuilding the Desktop profile did not resolve the issue
- The behavior does not appear to be a conventional ChatGPT.exe process crash

The most suspicious transition is:

authenticatedAccountPresent=true
        ↓
GET /backend-api/accounts/{account_id}/settings
HTTP 401
hadToken=true
        ↓
hasToken=false
nullReason=auth_token_missing
refreshToken=true
        ↓
authenticatedAccountPresent=false
failureType=account_info_token_unavailable
        ↓
Desktop returns to login screen

This looks like a Windows Desktop authentication/token-state regression.

After /accounts/{account_id}/settings returns HTTP 401, the Desktop appears to lose the current access token. Although refreshToken=true is still reported, the access token is not successfully recovered or re-attached before the account is marked unauthenticated.

I have redacted the real account ID and other identifying information from the logs.

Activity

  1. added
    app
    on Aug 24, 2026
  2. added
    bug
    windows-os
    auth
    on Aug 24, 2026
  3. amazyzhou1994 commented on Aug 24, 2026

    @amazyzhou1994
    Author

    I reviewed the potential duplicates listed above.

    My issue appears very similar to #39850 and #40373, especially the /accounts/{account_id}/settings 401 → auth_token_missing → account_info_token_unavailable sequence.

    One potentially useful difference in my case is that Advanced Account Security is not enabled.

    Also, while the Windows Desktop loses authentication and returns to the login screen, ChatGPT Web continues to work normally and Codex CLI remains authenticated. A real Codex CLI model request also succeeds after falling back from WebSocket to HTTPS.

    I can provide additional redacted Desktop logs if needed.

  4. zeekoe commented on Aug 24, 2026

    @zeekoe

    Did you try Codex CLI 0.149.1? On OS X I found a similar regression from 0.148.0 -> 0.149.1; I skipped 0.149.0.

  5. PROFFESSOR0x commented on Aug 24, 2026

    @PROFFESSOR0x

    Me too same

  6. PROFFESSOR0x commented on Aug 27, 2026

    @PROFFESSOR0x

    very simple i fixed it by re signing in but with the codex cli and then use the app
    because the cli and app uses the same config files
    other reason to use the cli : i have problem with auto open browser to signin using app i just copied the url from the cli and used it
    note: i used the same account i didn't change it

    im sorry i know my english is not good but i want to help

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

    appauthbugwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions