Skip to content

Commit e2cd82b

Browse files
Run full test suite and fix any failures\n\nTask ID: task-5.1-final-validation
1 parent 83d6393 commit e2cd82b

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

rust/src/auth/oauth/callback.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,10 @@ impl CallbackServer {
152152
/// Returns the redirect URI for this callback server.
153153
///
154154
/// This URI should be used when constructing the OAuth authorization URL.
155-
/// The format is `http://localhost:{port}/callback`.
155+
/// The format is `http://localhost:{port}` (matching the redirect URI
156+
/// registered for the `databricks-cli` OAuth application).
156157
pub fn redirect_uri(&self) -> String {
157-
format!("http://localhost:{}/callback", self.port)
158+
format!("http://localhost:{}", self.port)
158159
}
159160

160161
/// Waits for the OAuth callback with the authorization code.
@@ -276,7 +277,7 @@ impl CallbackServer {
276277

277278
let request = String::from_utf8_lossy(&buffer[..n]);
278279

279-
// Parse the request line (e.g., "GET /callback?code=...&state=... HTTP/1.1")
280+
// Parse the request line (e.g., "GET /?code=...&state=... HTTP/1.1")
280281
let first_line = request.lines().next().unwrap_or("");
281282
let parts: Vec<&str> = first_line.split_whitespace().collect();
282283

@@ -424,7 +425,7 @@ mod tests {
424425
.expect("Failed to connect to callback server");
425426

426427
let request = format!(
427-
"GET /callback?code=test-auth-code-123&state={} HTTP/1.1\r\nHost: localhost:{}\r\n\r\n",
428+
"GET /?code=test-auth-code-123&state={} HTTP/1.1\r\nHost: localhost:{}\r\n\r\n",
428429
expected_state, port
429430
);
430431

@@ -465,7 +466,7 @@ mod tests {
465466
.expect("Failed to connect");
466467

467468
let request = format!(
468-
"GET /callback?code=auth-code&state={} HTTP/1.1\r\nHost: localhost:{}\r\n\r\n",
469+
"GET /?code=auth-code&state={} HTTP/1.1\r\nHost: localhost:{}\r\n\r\n",
469470
wrong_state, port
470471
);
471472

@@ -529,7 +530,7 @@ mod tests {
529530

530531
// Send callback without 'code' parameter
531532
let request = format!(
532-
"GET /callback?state=test-state HTTP/1.1\r\nHost: localhost:{}\r\n\r\n",
533+
"GET /?state=test-state HTTP/1.1\r\nHost: localhost:{}\r\n\r\n",
533534
port
534535
);
535536

@@ -560,7 +561,7 @@ mod tests {
560561

561562
// Simulate authorization server error response
562563
let request = format!(
563-
"GET /callback?error=access_denied&error_description=User%20denied%20consent HTTP/1.1\r\nHost: localhost:{}\r\n\r\n",
564+
"GET /?error=access_denied&error_description=User%20denied%20consent HTTP/1.1\r\nHost: localhost:{}\r\n\r\n",
564565
port
565566
);
566567

0 commit comments

Comments
 (0)