[macOS] Refresh token is revoked after successful ChatGPT login, causing 401 in Desktop and CLI
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
What version of the Codex App are you using (From “About Codex” dialog)?
Codex CLI 0.152.0
What subscription do you have?
ChatGPT Plus
What platform is your computer?
Darwin 25.5.0 arm64 arm
What issue are you seeing?
Codex authentication is failing on my Mac even though signing in with ChatGPT succeeds.
Both Codex Desktop and Codex CLI return:
unexpected status 401 Unauthorized: {"detail":"Unauthorized"}, url: https://chatgpt.com/backend-api/codex/responses
I also previously received the following message in Codex Desktop:
Your access token could not be refreshed because your refresh token was revoked. Please log out and sign in again.
Environment:
- macOS
- ChatGPT Plus
- Codex CLI 0.152.0
- Authentication method: ChatGPT
- ChatGPT web works normally
- Codex Desktop fails with 401
- Codex CLI fails with 401
I confirmed that Codex is logged into the correct ChatGPT Plus account.
I have already tried:
codex logoutand signing in againcodex login --device-auth- Removing/renaming
~/.codex/auth.jsonand performing a fresh login - Upgrading Codex CLI from 0.144.6 to 0.152.0
- Confirming that only one ChatGPT account is logged into the browser
- Testing both Codex Desktop and Codex CLI
Device-code authentication completes successfully, and:
codex login status
reports:
Logged in using ChatGPT
However, immediately after starting Codex and sending a simple prompt such as hello, the request to /backend-api/codex/responses returns 401 Unauthorized.
Expected behavior:
After a successful ChatGPT authentication, Codex Desktop and CLI should be able to send requests normally.
Actual behavior:
Authentication appears successful locally, but requests to the Codex backend are rejected with 401 Unauthorized. In some cases Codex reports that the refresh token has been revoked.
This appears similar to other recent refresh-token invalidation/authentication issues reported for Codex on macOS.
What steps can reproduce the bug?
- Sign in to Codex using a ChatGPT Plus account.
- Confirm
codex login statusshowsLogged in using ChatGPT. - Start Codex Desktop or run
codexin the terminal. - Send a simple prompt such as
hello. - Codex attempts to connect to
https://chatgpt.com/backend-api/codex/responses. - The request fails with
401 Unauthorized.
What is the expected behavior?
Codex should accept the authenticated ChatGPT session and respond to prompts normally.
Additional information
■ unexpected status 401 Unauthorized: {"detail":"Unauthorized"}, url: https://chatgpt.com/backend-api/codex/responses,
cf-ray: a34164fe1fa7df0a-SJC, request id: 40d8632f-c671-45d7-b6dc-e26d967e9d9b
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with codex login --device-auth, codex login status, and a simple hello prompt in Codex Desktop or CLI, observing the request to /backend-api/codex/responses. Trace the ChatGPT refresh-token handling involved in the 401 and revoked-token messages; done means successful macOS login allows requests from both clients without authentication errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos, rust
- Domain
- api, authentication, cli, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 42/100