← All guides

Codex 401, token_expired or refresh_token_reused: what to do

Sign in again on desktop, IDE or CLI to handle 401 and expired-token errors.

Updated

Start here

Save your work, sign out and sign back in, then send a short test. If only one plugin fails, reauthorize that connection first.

On this page

1. Identify the failing connection

  1. If ordinary chats also show 401, token_expired or refresh_token_reused, follow the sign-in steps below.
  2. If only a plugin or app fails, reauthorize it in its connection settings. For API-key or organization sign-in, check the key or ask the administrator.

2. CLI: use a regular terminal

  1. Save your work and run the commands below one at a time in PowerShell or Terminal.
  2. Authorize the original account in the browser, wait for success in the terminal, then run codex.
codex login status
codex logout
codex login
codex login status

3. Desktop or IDE: use the account menu

  1. Open the profile or account menu and select Log out.
  2. Choose Sign in with ChatGPT, authorize the original account in the browser, then return to the client.

4. Send a short test

  1. Start a new chat and send “Reply only OK, without using tools.” Continue the original task after a reply.
  2. If the client keeps waiting or localhost fails after browser authorization, use the callback guide.

Login callback help →

5. Contact support

  1. Provide the client version, sign-in method and error screenshot after signing in again.
  2. Keep just the tested client open and tell support whether other clients also fail.

Contact support →

Useful links