Cannot sign in to a Codex account that uses a Google email - Codex
Quick fix
Upgrade cc-switch to v3.16.1+, or edit ~/.codex/auth.json by hand to restore auth_mode to chatgpt and clear OPENAI_API_KEY.
Symptom
Section titled “Symptom”关闭cc switch 的codex 配置,也无法使用谷歌邮箱登录的codex账号Even after disabling the cc-switch codex config, I still cannot sign in to the codex account that uses a Google email.
When taking over or switching Codex provider, cc-switch modifies `~/.codex/auth.json` and `config.toml`. Early versions (v3.16.0 and earlier) wrote the third-party API key straight into the `OPENAI_API_KEY` field of `auth.json`, so Codex forcibly detected `auth_mode="ApiKey"` and the official ChatGPT OAuth login state broke — leaving Fast mode unavailable, usage queries failing, or the model list blank. A leftover `OPENAI_API_KEY` also confuses the state when clearing config or switching back to an official provider.
v3.16.1 introduced per-app credential resolution and provider-scoped auth logic, fixing most of the credential overwriting. But edge cases remain — `codex resume` not reading the latest `model_provider`, or a half-expired `id_token` on the Desktop side — and still need manual intervention or a check of the local cache state.
Upgrade cc-switch to v3.16.1 or newer to get per-app credential resolution and provider-scoped auth logic.
To restore the official ChatGPT login state, edit `~/.codex/auth.json` by hand, set `auth_mode` to `chatgpt`, and clear `OPENAI_API_KEY`.
// ~/.codex/auth.json{"auth_mode": "chatgpt","OPENAI_API_KEY": null}If you use a custom provider and need to keep the official login working, pass the API key with `env_key` or `experimental_bearer_token` in `config.toml` rather than overwriting `auth.json`.
// ~/.codex/config.toml[model_providers.custom]name = "custom"base_url = "https://example-gateway/v1"env_key = "MY_PROVIDER_API_KEY"requires_openai_auth = false
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 7 real issues
- #1358codex.app 和cc switch 问题
- #2776Codex用量查询不显示
- #3034Codex custom provider API key is written to auth.json, forcing auth_mode=ApiKey and conflicting with ChatGPT login/Fast mode
- #3596Codex App Enhancements can preserve OAuth but still consume Auth quota instead of API billing
- #3903Codex official provider does not clear stale OPENAI_API_KEY from auth.json
- #5679Bug: Codex Desktop 模型选择器空白 — `/v1/models` 响应格式不兼容
- #6608切换到第三方Codex provider 后,codex resume 不生效(新建会话正常)
- Why are Codex Desktop Fast mode or remote control unavailable after switching to a third-party provider?
- Older cc-switch wrote the API key into `auth.json`, turning `auth_mode` into `ApiKey`, so Codex decided you were not using the official login. Upgrade to v3.16.1+ or keep `auth_mode: chatgpt` by hand.
- Why can `codex resume` not use a custom provider?
- `codex resume` reads the provider recorded when the session was created rather than the current top-level `model_provider` in `config.toml`. Pass `-c 'model_provider="custom"'` explicitly at launch.
- Why is the Codex Desktop model picker blank?
- Either the `/v1/models` response format is incompatible, or the `id_token` in `auth.json` has expired even though the `access_token` is still valid. Check the JWT `exp` field and sign in again.
Related problems
Section titled “Related problems”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.