#Codex Token Issue

1 messages · Page 1 of 1 (latest)

fossil moth
#

I’m getting this message in Codex CLI after being off for a while. I have logged off, closed Warp, even restart my computer. How do I fix this?

ripe wagonBOT
#

Hi @fossil moth. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

The knowledge sources don’t mention your exact error message, so I can’t be certain of the root cause. Here are the concrete, documented steps you can try based on how Codex auth and tokens work:

  1. Check whether it’s a broader outage
    Visit the OpenAI status page to see if Codex / Responses API are degraded; recent Codex issues have been caused by temporary backend problems rather than local setup. [Codex error rate]

  2. Force a fresh login cache

    Codex CLI and IDEs share the same cached credentials in ~/.codex/auth.json or your OS keyring. Corrupted or expired tokens can cause persistent auth errors. [Codex auth]

    Try:

    # 1) Log out fully
    codex logout
    
    # 2) (Optional but often helpful) Remove cached auth file if it exists
    mv ~/.codex/auth.json ~/.codex/auth.json.bak 2>/dev/null || true
    
    # 3) Log in again
    codex login
    

    Then choose either:

    • Sign in with ChatGPT (browser or device code), or
    • Sign in with API key (paste a valid key from the OpenAI dashboard). [Codex auth; Auth endpoints]
  3. If you’re on a headless/remote setup or browser login fails

    Use device code auth, which is the recommended path when the normal browser callback is unreliable: [Login on headless devices]

    codex login --device-auth
    

    Then open the shown URL in a browser, sign in, and enter the one-time code.

  4. If your system uses file-based auth and you still see token issues

#

You can log in successfully on a machine where the flow works, then copy the working ~/.codex/auth.json to the problem machine (treat it like a password). [Login on headless devices]

If you can share the exact error text from Codex CLI, the docs may have something more specific; with the current sources, these are the only clearly documented remediation steps.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@fossil moth Kapa.ai is still learning and improving, please let me know how I did by reacting below.

fossil moth
#

The screenshots show the errors