Skip to content

auth.json not updated after switching channel - Codex

Quick fix

Codex auth.json is not updated after switching channels. Manually modify auth.json or wait for cc-switch to fix it.

Error output
切换渠道之后,auth.json完全没变
English translation

After switching channels, auth.json remains completely unchanged

This issue involves cc-switch failing to correctly write the authentication file when switching Codex and Claude Code official OAuth channels. In the Codex scenario, users reported that after switching providers, the API key in C:\Users\Administrator\.codex\auth.json did not change, causing Codex model requests to fail. Comments indicate that after switching, the current provider's API address is used, but the old provider's key is used for validation. In the Claude Code scenario, the root cause is that cc-switch did not correctly replace the oauthAccount object in ~/.claude.json during switching, causing claude auth status to always show the old account information. The maintainer replied in #6782 that Codex recently underwent a major refactoring of its authentication method, and cc-switch will release an urgent update to fix these issues.

  1. For the issue of Codex channel switching being ineffective, since the maintainer has confirmed it is a compatibility bug caused by Codex authentication refactoring, it is recommended to wait for cc-switch to release an urgent update to fix it.

    # C:\Users\Administrator\.codex\auth.json
  2. For the issue of Claude Code multi-account hot switching being ineffective, you can try manually deleting the oauthAccount field in ~/.claude.json and then running claude auth login again, but cc-switch may still not correctly write the corresponding Provider's oauthAccount data during subsequent switches.

    # ~/.claude.json
ToolCodex / Claude Code
Version3.16.3 - 3.20
PlatformsWindows
What to do if Codex model requests fail after switching providers?
Check whether the API key in C:\Users\Administrator\.codex\auth.json has been updated. If it has not changed, it means cc-switch switching did not take effect. You need to wait for cc-switch to fix it or manually modify auth.json.
What to do if claude auth status always shows the old account after switching accounts in Claude Code?
The root cause is that the oauthAccount field in ~/.claude.json was not correctly replaced. You can try manually deleting this field and then running claude auth login again, but cc-switch's switching function itself still needs to be fixed.

This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.