This commit is contained in:
celia-oai
2026-06-10 17:45:32 -07:00
parent a0f0d0d193
commit 3f91bb0806
25 changed files with 577 additions and 78 deletions
+12 -5
View File
@@ -1196,7 +1196,11 @@ fn auth_check(config: &Config) -> DoctorCheck {
return check;
}
match load_auth_dot_json(&config.codex_home, config.cli_auth_credentials_store_mode) {
match load_auth_dot_json(
&config.codex_home,
config.cli_auth_credentials_store_mode,
config.cli_auth_keyring_backend_kind(),
) {
Ok(Some(auth)) => {
details.push(format!("stored auth mode: {}", stored_auth_mode(&auth)));
details.push(format!("stored API key: {}", auth.openai_api_key.is_some()));
@@ -2519,10 +2523,13 @@ impl ProviderAuthReachabilityMode {
}
fn provider_reachability_plan(config: &Config) -> ReachabilityPlan {
let stored_auth =
load_auth_dot_json(&config.codex_home, config.cli_auth_credentials_store_mode)
.ok()
.flatten();
let stored_auth = load_auth_dot_json(
&config.codex_home,
config.cli_auth_credentials_store_mode,
config.cli_auth_keyring_backend_kind(),
)
.ok()
.flatten();
let mode = provider_auth_reachability_mode_from_auth(
config.model_provider.requires_openai_auth,
env_var_present,
+16 -1
View File
@@ -11,6 +11,7 @@ use codex_app_server_protocol::AuthMode;
use codex_config::types::AuthCredentialsStoreMode;
use codex_core::config::Config;
use codex_login::CLIENT_ID;
use codex_login::CliAuthKeyringBackendKind;
use codex_login::CodexAuth;
use codex_login::ServerOptions;
use codex_login::login_with_access_token;
@@ -117,12 +118,14 @@ pub async fn login_with_chatgpt(
codex_home: PathBuf,
forced_chatgpt_workspace_id: Option<Vec<String>>,
cli_auth_credentials_store_mode: AuthCredentialsStoreMode,
cli_auth_keyring_backend_kind: CliAuthKeyringBackendKind,
) -> std::io::Result<()> {
let opts = ServerOptions::new(
codex_home,
CLIENT_ID.to_string(),
forced_chatgpt_workspace_id,
cli_auth_credentials_store_mode,
cli_auth_keyring_backend_kind,
);
let server = run_login_server(opts)?;
@@ -147,6 +150,7 @@ pub async fn run_login_with_chatgpt(cli_config_overrides: CliConfigOverrides) ->
config.codex_home.to_path_buf(),
forced_chatgpt_workspace_id,
config.cli_auth_credentials_store_mode,
config.cli_auth_keyring_backend_kind(),
)
.await
{
@@ -178,6 +182,7 @@ pub async fn run_login_with_api_key(
&config.codex_home,
&api_key,
config.cli_auth_credentials_store_mode,
config.cli_auth_keyring_backend_kind(),
) {
Ok(_) => {
eprintln!("{LOGIN_SUCCESS_MESSAGE}");
@@ -208,6 +213,7 @@ pub async fn run_login_with_access_token(
&access_token,
config.cli_auth_credentials_store_mode,
Some(&config.chatgpt_base_url),
config.cli_auth_keyring_backend_kind(),
)
.await
{
@@ -282,6 +288,7 @@ pub async fn run_login_with_device_code(
client_id.unwrap_or(CLIENT_ID.to_string()),
forced_chatgpt_workspace_id,
config.cli_auth_credentials_store_mode,
config.cli_auth_keyring_backend_kind(),
);
if let Some(iss) = issuer_base_url {
opts.issuer = iss;
@@ -321,6 +328,7 @@ pub async fn run_login_with_device_code_fallback_to_browser(
client_id.unwrap_or(CLIENT_ID.to_string()),
forced_chatgpt_workspace_id,
config.cli_auth_credentials_store_mode,
config.cli_auth_keyring_backend_kind(),
);
if let Some(iss) = issuer_base_url {
opts.issuer = iss;
@@ -369,6 +377,7 @@ pub async fn run_login_status(cli_config_overrides: CliConfigOverrides) -> ! {
&config.codex_home,
config.cli_auth_credentials_store_mode,
Some(&config.chatgpt_base_url),
config.cli_auth_keyring_backend_kind(),
)
.await
{
@@ -410,7 +419,13 @@ pub async fn run_login_status(cli_config_overrides: CliConfigOverrides) -> ! {
pub async fn run_logout(cli_config_overrides: CliConfigOverrides) -> ! {
let config = load_config_or_exit(cli_config_overrides).await;
match logout_with_revoke(&config.codex_home, config.cli_auth_credentials_store_mode).await {
match logout_with_revoke(
&config.codex_home,
config.cli_auth_credentials_store_mode,
config.cli_auth_keyring_backend_kind(),
)
.await
{
Ok(true) => {
eprintln!("Successfully logged out");
std::process::exit(0);