Skip to content

Commit c602272

Browse files
committed
add auth status to portal
1 parent 41bda6e commit c602272

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

crates/chat-cli/src/auth/portal.rs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use crate::database::{
3838
};
3939
use 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";
4242
const DEFAULT_AUTHORIZATION_TIMEOUT: Duration = Duration::from_secs(600);
4343
const 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
}

crates/chat-cli/src/cli/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,7 @@ impl Cli {
234234
},
235235
log_to_stdout: std::env::var_os("Q_LOG_STDOUT").is_some() || self.verbose > 0,
236236
log_file_path: match subcommand {
237-
RootSubcommand::Chat { .. } | RootSubcommand::Login { .. } => {
238-
Some(logs_dir().expect("home dir must be set").join("qchat.log"))
239-
},
237+
RootSubcommand::Chat { .. } => Some(logs_dir().expect("home dir must be set").join("qchat.log")),
240238
_ => None,
241239
},
242240
delete_old_log_file: false,

0 commit comments

Comments
 (0)