mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-25 13:45:03 +08:00
feat(codex): preserve OAuth login state during third-party provider switching
Codex provider switches now only write config.toml for third-party providers, injecting the API key as experimental_bearer_token. The user's auth.json (ChatGPT OAuth tokens) is preserved. Official providers with login material still write auth.json normally. Backfill restores bearer tokens into stored provider auth.OPENAI_API_KEY to maintain canonical shape.
This commit is contained in:
@@ -82,7 +82,8 @@ pub async fn get_config_status(
|
||||
}
|
||||
AppType::Codex => {
|
||||
let auth_path = codex_config::get_codex_auth_path();
|
||||
let exists = auth_path.exists();
|
||||
let config_text = codex_config::read_codex_config_text().unwrap_or_default();
|
||||
let exists = auth_path.exists() || !config_text.trim().is_empty();
|
||||
let path = codex_config::get_codex_config_dir()
|
||||
.to_string_lossy()
|
||||
.to_string();
|
||||
|
||||
Reference in New Issue
Block a user