From ee453b3b682de881abab31824d8632db2c5d52c2 Mon Sep 17 00:00:00 2001 From: rakesh Date: Tue, 30 Sep 2025 16:59:04 -0700 Subject: [PATCH 1/2] Fix Callback URL --- codex-rs/login/src/device_code_auth.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/codex-rs/login/src/device_code_auth.rs b/codex-rs/login/src/device_code_auth.rs index 0d04a61337..385a97fd43 100644 --- a/codex-rs/login/src/device_code_auth.rs +++ b/codex-rs/login/src/device_code_auth.rs @@ -148,15 +148,14 @@ fn print_colored_warning_device_code() { /// Full device code login flow. pub async fn run_device_code_login(opts: ServerOptions) -> std::io::Result<()> { let client = reqwest::Client::new(); - let auth_base_url = opts.issuer.trim_end_matches('/').to_owned(); + let auth_base_url = format!("{}/api/accounts", opts.issuer.trim_end_matches('/')); print_colored_warning_device_code(); println!("⏳ Generating a new 9-digit device code for authentication...\n"); let uc = request_user_code(&client, &auth_base_url, &opts.client_id).await?; println!( "To authenticate, visit: {}/deviceauth/authorize and enter code: {}", - opts.issuer.trim_end_matches('/'), - uc.user_code + auth_base_url, uc.user_code ); let code_resp = poll_for_token( From a29f0a6aae0dd3ebd13dcebf454bc4eb31af13c2 Mon Sep 17 00:00:00 2001 From: rakesh Date: Tue, 30 Sep 2025 19:43:54 -0700 Subject: [PATCH 2/2] fix test --- codex-rs/login/tests/suite/device_code_login.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/codex-rs/login/tests/suite/device_code_login.rs b/codex-rs/login/tests/suite/device_code_login.rs index 0b63b98a6d..4bd5e2e36b 100644 --- a/codex-rs/login/tests/suite/device_code_login.rs +++ b/codex-rs/login/tests/suite/device_code_login.rs @@ -32,7 +32,7 @@ fn make_jwt(payload: serde_json::Value) -> String { async fn mock_usercode_success(server: &MockServer) { Mock::given(method("POST")) - .and(path("/deviceauth/usercode")) + .and(path("/api/accounts/deviceauth/usercode")) .respond_with(ResponseTemplate::new(200).set_body_json(json!({ "device_auth_id": "device-auth-123", "user_code": "CODE-12345", @@ -45,7 +45,7 @@ async fn mock_usercode_success(server: &MockServer) { async fn mock_usercode_failure(server: &MockServer, status: u16) { Mock::given(method("POST")) - .and(path("/deviceauth/usercode")) + .and(path("/api/accounts/deviceauth/usercode")) .respond_with(ResponseTemplate::new(status)) .mount(server) .await; @@ -58,7 +58,7 @@ async fn mock_poll_token_two_step( ) { let c = counter.clone(); Mock::given(method("POST")) - .and(path("/deviceauth/token")) + .and(path("/api/accounts/deviceauth/token")) .respond_with(move |_: &Request| { let attempt = c.fetch_add(1, Ordering::SeqCst); if attempt == 0 { @@ -214,7 +214,7 @@ async fn device_code_login_integration_handles_error_payload() { // // /deviceauth/token → returns error payload with status 401 mock_poll_token_single( &mock_server, - "/deviceauth/token", + "/api/accounts/deviceauth/token", ResponseTemplate::new(401).set_body_json(json!({ "error": "authorization_declined", "error_description": "Denied"