@@ -83,14 +83,14 @@ pub async fn start_unified_auth(db: &mut Database) -> Result<PortalResult, AuthE
8383 let listener = bind_allowed_port ( CALLBACK_PORTS ) . await ?;
8484 let port = listener. local_addr ( ) ?. port ( ) ;
8585
86- let redirect_base = format ! ( "http://localhost:{}" , port ) ;
86+ let redirect_base = format ! ( "http://localhost:{port}" ) ;
8787 info ! ( %port, %redirect_base, "Unified auth portal listening for callback" ) ;
8888
8989 let auth_url = build_auth_url ( & redirect_base, & state, & challenge) ;
9090
9191 crate :: util:: open:: open_url_async ( & auth_url)
9292 . await
93- . map_err ( |e| AuthError :: OAuthCustomError ( format ! ( "Failed to open browser: {}" , e ) ) ) ?;
93+ . map_err ( |e| AuthError :: OAuthCustomError ( format ! ( "Failed to open browser: {e}" ) ) ) ?;
9494
9595 let callback = wait_for_auth_callback ( listener, state. clone ( ) ) . await ?;
9696
@@ -121,20 +121,17 @@ fn format_user_friendly_error(error_code: &str, description: Option<&str>, provi
121121
122122 match error_code {
123123 "access_denied" => {
124- format ! (
125- "{} denied access to Kiro. Please ensure you grant all required permissions." ,
126- provider
127- )
124+ format ! ( "{provider} denied access to Kiro. Please ensure you grant all required permissions." )
128125 } ,
129126 "invalid_request" => "Authentication failed due to an invalid request. Please try again." . to_string ( ) ,
130127 "unauthorized_client" => "The application is not authorized. Please contact support." . to_string ( ) ,
131128 "server_error" => {
132- format ! ( "{} login is temporarily unavailable. Please try again later." , provider )
129+ format ! ( "{provider } login is temporarily unavailable. Please try again later." )
133130 } ,
134131 "invalid_scope" => "The requested permissions are invalid. Please contact support." . to_string ( ) ,
135132 _ => {
136133 // For unknown errors, use cleaned description or a generic message
137- cleaned_description. unwrap_or_else ( || format ! ( "Authentication failed: {}. Please try again." , error_code ) )
134+ cleaned_description. unwrap_or_else ( || format ! ( "Authentication failed: {error_code }. Please try again." ) )
138135 } ,
139136 }
140137}
@@ -183,7 +180,7 @@ async fn process_portal_callback(
183180 idc_region : sso_region,
184181 } )
185182 } ,
186- other => Err ( AuthError :: OAuthCustomError ( format ! ( "Unknown login_option: {}" , other ) ) ) ,
183+ other => Err ( AuthError :: OAuthCustomError ( format ! ( "Unknown login_option: {other}" ) ) ) ,
187184 }
188185}
189186
@@ -217,12 +214,12 @@ fn extract_sso_params(callback: &AuthPortalCallback, auth_type: &str) -> Result<
217214 let issuer_url = callback
218215 . issuer_url
219216 . clone ( )
220- . ok_or_else ( || AuthError :: OAuthCustomError ( format ! ( "Missing issuer_url for {} auth" , auth_type ) ) ) ?;
217+ . ok_or_else ( || AuthError :: OAuthCustomError ( format ! ( "Missing issuer_url for {auth_type } auth" ) ) ) ?;
221218
222219 let sso_region = callback
223220 . sso_region
224221 . clone ( )
225- . ok_or_else ( || AuthError :: OAuthCustomError ( format ! ( "Missing sso_region for {} auth" , auth_type ) ) ) ?;
222+ . ok_or_else ( || AuthError :: OAuthCustomError ( format ! ( "Missing sso_region for {auth_type } auth" ) ) ) ?;
226223
227224 Ok ( ( issuer_url, sso_region) )
228225}
@@ -357,7 +354,7 @@ async fn handle_invalid_callback(path: &str) -> Result<Response<Full<Bytes>>, Au
357354
358355/// Build a redirect response to the auth portal
359356fn build_redirect_response ( status : & str , error_message : Option < & str > ) -> Result < Response < Full < Bytes > > , AuthError > {
360- let mut redirect_url = format ! ( "{}?auth_status={}&redirect_from=kirocli" , AUTH_PORTAL_URL , status ) ;
357+ let mut redirect_url = format ! ( "{AUTH_PORTAL_URL }?auth_status={status }&redirect_from=kirocli" ) ;
361358
362359 if let Some ( msg) = error_message {
363360 redirect_url. push_str ( & format ! ( "&error_message={}" , urlencoding:: encode( msg) ) ) ;
0 commit comments