@@ -38,7 +38,7 @@ use crate::database::{
3838} ;
3939use crate :: util:: system_info:: is_mwinit_available;
4040
41- const AUTH_PORTAL_URL : & str = "https://gamma. app.kiro.aws.dev/signin" ;
41+ const AUTH_PORTAL_URL : & str = "https://app.kiro.aws.dev/signin" ;
4242const DEFAULT_AUTHORIZATION_TIMEOUT : Duration = Duration :: from_secs ( 600 ) ;
4343const USER_AGENT : & str = "Kiro-CLI" ;
4444
@@ -249,16 +249,28 @@ impl Service<Request<Incoming>> for AuthCallbackService {
249249
250250 let _ = tx. send ( callback) . await ;
251251
252+ let redirect_url = format ! ( "{}?auth_status=success&redirect_from=kirocli" , AUTH_PORTAL_URL ) ;
253+
252254 Ok ( Response :: builder ( )
253255 . status ( 302 )
254- . header ( "Location" , AUTH_PORTAL_URL )
256+ . header ( "Location" , redirect_url )
255257 . header ( "Cache-Control" , "no-store" )
256- . body ( "" . into ( ) )
257- . expect ( "valid builder " ) )
258+ . body ( Full :: new ( Bytes :: from ( "" ) ) )
259+ . expect ( "valid response " ) )
258260 } else {
259- info ! ( %path, "Ignoring non-callback path" ) ;
261+ // Invalid path - redirect back to portal with error
262+ info ! ( %path, "Invalid callback path, redirecting to portal" ) ;
263+
264+ let redirect_url = format ! (
265+ "{}?auth_status=error&redirect_from=kirocli&error_message={}" ,
266+ AUTH_PORTAL_URL ,
267+ urlencoding:: encode( "Invalid callback path" )
268+ ) ;
269+
260270 Ok ( Response :: builder ( )
261- . status ( 404 )
271+ . status ( 302 )
272+ . header ( "Location" , redirect_url)
273+ . header ( "Cache-Control" , "no-store" )
262274 . body ( Full :: new ( Bytes :: from ( "" ) ) )
263275 . expect ( "valid response" ) )
264276 }
0 commit comments