diff --git a/src/auth/oauth_common.rs b/src/auth/oauth_common.rs index 8724f29d9..3b151b147 100644 --- a/src/auth/oauth_common.rs +++ b/src/auth/oauth_common.rs @@ -99,9 +99,8 @@ pub fn detect_url_truncation(input: &str, expected_state_len: usize) -> Option Res if pending.profile != profile { bail!( - "Pending login profile mismatch: pending={}, requested={}", + "{} pending={}, requested={}", + PROFILE_MISMATCH_PREFIX, pending.profile, profile ); @@ -1982,7 +1985,7 @@ async fn handle_auth_command(auth_command: AuthCommands, config: &Config) -> Res if let Err(e) = result { // Cleanup pending file on error - if e.to_string().contains("profile mismatch") { + if e.to_string().starts_with(PROFILE_MISMATCH_PREFIX) { clear_pending_oauth_login(config, "openai"); eprintln!("❌ {}", e); eprintln!( @@ -2014,7 +2017,8 @@ async fn handle_auth_command(auth_command: AuthCommands, config: &Config) -> Res if pending.profile != profile { bail!( - "Pending login profile mismatch: pending={}, requested={}", + "{} pending={}, requested={}", + PROFILE_MISMATCH_PREFIX, pending.profile, profile ); @@ -2058,7 +2062,7 @@ async fn handle_auth_command(auth_command: AuthCommands, config: &Config) -> Res if let Err(e) = result { // Cleanup pending file on error - if e.to_string().contains("profile mismatch") { + if e.to_string().starts_with(PROFILE_MISMATCH_PREFIX) { clear_pending_oauth_login(config, "gemini"); eprintln!("❌ {}", e); eprintln!(