Skip to content

Login required: Claude Code login prompt after takeover with Codex OAuth

Quick fix

User-tested: after Claude takeover, keep ANTHROPIC_AUTH_TOKEN (even empty) in ~/.claude/settings.json env before starting Claude Code to avoid login prompts.

Error output
当 takeover 结果中 `env` 里只保留 `ANTHROPIC_API_KEY`,而主动删除 `ANTHROPIC_AUTH_TOKEN` 时,启动 Claude Code 会提示需要登录。
English translation

When the takeover result keeps only `ANTHROPIC_API_KEY` in `env` and explicitly deletes `ANTHROPIC_AUTH_TOKEN`, starting Claude Code triggers a login prompt.

The report states that the managed-account Claude takeover branch in cc-switch 3.16.1 deletes ANTHROPIC_AUTH_TOKEN and writes only ANTHROPIC_API_KEY = PROXY_MANAGED. This logic was intended to prevent proxy placeholder values from being mistakenly sent upstream. However, the reporter's tests with Codex OAuth found that a missing env.ANTHROPIC_AUTH_TOKEN triggers the Claude Code login prompt. Keeping the field, even with an empty string, prevents the prompt. The reporter therefore suspects that deleting this field during takeover is the cause.

These are user-reported findings and test results; no maintainer-confirmed fix is documented. Keeping the field, leaving it unchanged, or handling Codex OAuth separately from Copilot were all adjustments proposed in the original post. The issue is closed, but the supplied content does not establish whether a patch was implemented or which version contains a fix.

  1. After completing Codex OAuth authentication and enabling Claude takeover, check env in ~/.claude/settings.json before starting Claude Code to see whether ANTHROPIC_AUTH_TOKEN was deleted.

  2. If the field was deleted, add ANTHROPIC_AUTH_TOKEN back to the existing env object. Its value can be an empty string; keep the JSON syntax valid. The original post reports that this avoids the login prompt. This is a user-tested workaround.

    // ~/.claude/settings.json
    "ANTHROPIC_AUTH_TOKEN": ""
  3. Start Claude Code and check whether the login prompt disappears. Follow the source issue for the status of an official fix; the original post does not identify a confirmed fixed version.

ToolClaude Code
Version3.16.1(cc-switch 报告受影响版本)
PlatformsWindows

(No FAQ yet)

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.