| Error | Your access token could not be refreshed. Please log out and sign in again. |
|---|---|
| Variants | ...because your refresh token has expired / was already used / was revoked; ...because you have since logged out or signed in to another account |
| Where it comes from | Codex's request to auth.openai.com/oauth/token was refused; the server's code picks the wording |
| Fix | codex logout + codex login, or Log out / sign in in the app |
| Keeps coming back (Windows) | Another process holding auth.json open can stop Codex saving new tokens (user report, #65248) |
| Reports | 3 people on GitHub, 25 Nov to 2 Dec 2026 (#63978, #64190, #65248). No OpenAI reply on these issues |
| Checked | 5 Dec 2026, against the sources listed below |
What each version means
All five messages are defined in Codex's source, codex-rs/login/src/auth/manager.rs (lines 248 to 253). Codex picks one from the error code OpenAI's token server returns (lines 1876 to 1897):
| Message ends with | Server code | Meaning |
|---|---|---|
| ...because your refresh token has expired | refresh_token_expired | The saved login is too old to renew |
| ...because your refresh token was already used | refresh_token_reused | The token Codex sent had already been exchanged once |
| ...because your refresh token was revoked | refresh_token_invalidated | The login was revoked on OpenAI's side |
| ...could not be refreshed. Please log out and sign in again. | anything else | Refused for another reason |
| ...because you have since logged out or signed in to another account | (local check) | The saved login now belongs to a different account than this session |
Codex refreshes ChatGPT tokens on its own during use. OpenAI's auth docs: "Codex refreshes tokens automatically during use before they expire, so active sessions usually continue without requiring another browser login." You only see this message when that renewal is refused. Codex doesn't retry it: RefreshTokenFailed is in the never-retry list in codex-rs/protocol/src/error.rs.
Fix it
- See how you're signed in:
codex login status. - Sign out and in again:
In the desktop app or IDE extension, use Log out in the profile menu, then sign in. The CLI and the extension share the same saved login, so logging out of one logs out of both.codex logout codex login - No browser on that machine, or the callback is blocked? Use
codex login --device-auth. OpenAI's docs: first enable device code login in your ChatGPT security settings (personal account) or workspace permissions (admin). - Using WSL? The Linux side has its own
~/.codex/auth.json. In #63978 a user who kept getting this message in the desktop app backed upauth.jsoninside Ubuntu, rancodex loginthere, and could continue the existing WSL chat.
It keeps coming back with "already used" (Windows)
In #65248 a user traced a repeating refresh_token_reused on Windows (codex-cli 0.167.0) to another process holding auth.json open. The refresh succeeded on the server, but Codex couldn't replace the file (a sharing violation) and didn't report it. The next request sent the old, already-used token, and the login died. Close programs that keep that file open, such as editors, sync or backup tools watching %USERPROFILE%\.codex, then sign in again.
OpenAI's docs also describe keyring storage, which keeps credentials in the OS credential store instead of auth.json:
cli_auth_credentials_store = "keyring"
Can't sign back in?
In #64190, after a "was revoked" message, the sign-in asked for an email verification code that never arrived (Sign in with Apple, private relay address), in both the app and codex login --device-auth. Nothing on the machine fixes that: it needs OpenAI support, which that user contacted.
Keep auth.json private
OpenAI: "treat ~/.codex/auth.json like a password: it contains access tokens. Don't commit it, paste it into tickets, or share it in chat." Back it up to a private location only.
Running Claude Code, Codex or Cursor on real repos, or shipping an AI agent? A Quick Review ($149 / ₹13,900, 1 working day) checks one repo, config or setup for leaked keys, risky agent permissions and MCP servers. Request a Quick Review
FAQ
How do I fix 'Your access token could not be refreshed' in Codex?
Sign out and in again: codex logout, then codex login (or codex login --device-auth). In the app, Log out from the profile menu and sign in.
What does 'refresh token was already used' mean?
OpenAI's token server returned refresh_token_reused: the token Codex sent had already been exchanged. On Windows, one user traced repeats to another program holding auth.json open so Codex couldn't save the new tokens.
What does 'refresh token was revoked' mean?
The server returned refresh_token_invalidated: the login was revoked on OpenAI's side. Sign in again.
Where does Codex store the login?
In ~/.codex/auth.json (under CODEX_HOME) or in your OS credential store, depending on cli_auth_credentials_store. The CLI and IDE extension share it.
Related errors
- Codex: You've hit your usage limit
- Codex not working on Windows
- Claude Code: Failed to authenticate / 403
Sources
Read 5 Dec 2026. These tools change often: if a step no longer matches, the linked page wins.
- Codex source: the five messages (login/src/auth/manager.rs L248-L253): github.com/openai/codex/blob/3ce8141ab3590a1afb0e5845e2e1e90647f36910/codex-rs/login/src/auth/manager.rs#L248-L253
- Codex source: server code to message mapping (login/src/auth/manager.rs L1876-L1897): github.com/openai/codex/blob/3ce8141ab3590a1afb0e5845e2e1e90647f36910/codex-rs/login/src/auth/manager.rs#L1876-L1897
- OpenAI docs: Codex authentication (logout, login status, device code, credential storage): developers.openai.com/codex/auth
- Codex source: RefreshTokenFailed is never retried (protocol/src/error.rs L543): github.com/openai/codex/blob/3ce8141ab3590a1afb0e5845e2e1e90647f36910/codex-rs/protocol/src/error.rs#L543
- openai/codex #65248 (Windows: auth.json held open, refresh_token_reused): github.com/openai/codex/issues/65248
- openai/codex #63978 (WSL: codex login inside Ubuntu): github.com/openai/codex/issues/63978
- openai/codex #64190 (revoked; email verification never arrives): github.com/openai/codex/issues/64190
- Exposed API key checker: find API keys committed to a repo or shipped to the browser
- reviewready CLI: one command that checks an AI app repo before it ships
- MCP config checker: scan your mcp.json for hard-coded tokens, unpinned servers and risky access