[codex] Add host-provided Codex auth

This commit is contained in:
Liang-Ting Jiang
2026-06-27 03:48:48 +00:00
parent c464468493
commit b204596f06
28 changed files with 275 additions and 7 deletions
+6
View File
@@ -1327,6 +1327,7 @@ fn stored_auth_mode(auth: &codex_login::AuthDotJson) -> &'static str {
AuthMode::ApiKey => "api_key",
AuthMode::Chatgpt => "chatgpt",
AuthMode::ChatgptAuthTokens => "chatgpt_auth_tokens",
AuthMode::HostProvided => "host_provided",
AuthMode::AgentIdentity => "agent_identity",
AuthMode::PersonalAccessToken => "personal_access_token",
AuthMode::BedrockApiKey => "bedrock_api_key",
@@ -1397,6 +1398,9 @@ fn stored_auth_issues(
issues.push("external ChatGPT auth is missing refresh metadata");
}
}
AuthMode::HostProvided => {
issues.push("host-provided auth cannot be loaded from auth storage");
}
AuthMode::AgentIdentity => {
if auth
.agent_identity
@@ -2466,6 +2470,7 @@ fn auth_mode_name(auth: &CodexAuth) -> &'static str {
AuthMode::ApiKey => "api_key",
AuthMode::Chatgpt => "chatgpt",
AuthMode::ChatgptAuthTokens => "chatgpt_auth_tokens",
AuthMode::HostProvided => "host_provided",
AuthMode::AgentIdentity => "agent_identity",
AuthMode::PersonalAccessToken => "personal_access_token",
AuthMode::BedrockApiKey => "bedrock_api_key",
@@ -2605,6 +2610,7 @@ fn provider_auth_reachability_mode_from_auth(
Some(
AuthMode::Chatgpt
| AuthMode::ChatgptAuthTokens
| AuthMode::HostProvided
| AuthMode::AgentIdentity
| AuthMode::PersonalAccessToken,
)
+4
View File
@@ -449,6 +449,10 @@ pub async fn run_login_status(cli_config_overrides: CliConfigOverrides) -> ! {
eprintln!("Logged in using ChatGPT");
std::process::exit(0);
}
AuthMode::HostProvided => {
eprintln!("Logged in using host-provided auth");
std::process::exit(0);
}
AuthMode::AgentIdentity => {
eprintln!("Logged in using access token");
std::process::exit(0);