From 8c40faf3175311b57ca6f762ff6f831bff4bcf31 Mon Sep 17 00:00:00 2001 From: augustuswm Date: Tue, 26 May 2026 17:11:10 -0500 Subject: [PATCH 1/2] Additional debugging. Handle non-spec verification uri --- v-api/src/endpoints/login/oauth/flow/device_token.rs | 7 ++++++- v-api/src/endpoints/login/oauth/mod.rs | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/v-api/src/endpoints/login/oauth/flow/device_token.rs b/v-api/src/endpoints/login/oauth/flow/device_token.rs index f9d4161..e6e2965 100644 --- a/v-api/src/endpoints/login/oauth/flow/device_token.rs +++ b/v-api/src/endpoints/login/oauth/flow/device_token.rs @@ -79,6 +79,7 @@ pub struct DeviceAuthorizationResponse { /// The end-user verification code displayed to the user. pub user_code: String, /// The end-user verification URI on the authorization server. + #[serde(alias = "verification_url")] pub verification_uri: Url, /// Optional verification URI that includes the user_code. #[serde(default)] @@ -92,7 +93,7 @@ pub struct DeviceAuthorizationResponse { } /// Body sent to the upstream provider's device authorization endpoint. -#[derive(Serialize)] +#[derive(Debug, Serialize)] struct UpstreamDeviceAuthzRequest { client_id: String, #[serde(skip_serializing_if = "Option::is_none")] @@ -152,6 +153,8 @@ where scope: Some(provider.default_scopes().join(" ")), }; + tracing::trace!(?upstream_request, "Sending device authorization request to upstream provider"); + let response = client .request(Method::POST, &device_info.remote.device_code_endpoint) .header(header::CONTENT_TYPE, "application/x-www-form-urlencoded") @@ -178,8 +181,10 @@ where // Parse the upstream device authorization response let device_authz: DeviceAuthorizationResponse = serde_json::from_slice(&bytes).map_err(|err| { + let body = String::from_utf8_lossy(&bytes); tracing::error!( ?err, + ?body, "Failed to parse upstream device authorization response" ); internal_error("Failed to parse upstream device authorization response") diff --git a/v-api/src/endpoints/login/oauth/mod.rs b/v-api/src/endpoints/login/oauth/mod.rs index daa3f40..e49d578 100644 --- a/v-api/src/endpoints/login/oauth/mod.rs +++ b/v-api/src/endpoints/login/oauth/mod.rs @@ -129,6 +129,7 @@ where let mut responses = vec![]; for endpoint in self.user_info_endpoints() { + tracing::trace!(?endpoint, "Requesting user information from OAuth provider endpoint"); let mut request = Request::new(Method::GET, endpoint.parse().unwrap()); self.initialize_headers(&mut request); @@ -144,8 +145,10 @@ where tracing::trace!(?status, "Received response from OAuth provider"); if !status.is_success() { + let body = response.text().await.unwrap_or_default(); tracing::error!( ?status, + ?body, endpoint, "User info endpoint returned non-success status" ); From 41df52045c9bf338c07b9af40c77d638021c6899 Mon Sep 17 00:00:00 2001 From: augustuswm Date: Wed, 27 May 2026 11:01:26 -0500 Subject: [PATCH 2/2] Fmt --- v-api/src/endpoints/login/oauth/flow/device_token.rs | 5 ++++- v-api/src/endpoints/login/oauth/mod.rs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/v-api/src/endpoints/login/oauth/flow/device_token.rs b/v-api/src/endpoints/login/oauth/flow/device_token.rs index e6e2965..ee608fa 100644 --- a/v-api/src/endpoints/login/oauth/flow/device_token.rs +++ b/v-api/src/endpoints/login/oauth/flow/device_token.rs @@ -153,7 +153,10 @@ where scope: Some(provider.default_scopes().join(" ")), }; - tracing::trace!(?upstream_request, "Sending device authorization request to upstream provider"); + tracing::trace!( + ?upstream_request, + "Sending device authorization request to upstream provider" + ); let response = client .request(Method::POST, &device_info.remote.device_code_endpoint) diff --git a/v-api/src/endpoints/login/oauth/mod.rs b/v-api/src/endpoints/login/oauth/mod.rs index e49d578..b7a7b72 100644 --- a/v-api/src/endpoints/login/oauth/mod.rs +++ b/v-api/src/endpoints/login/oauth/mod.rs @@ -129,7 +129,10 @@ where let mut responses = vec![]; for endpoint in self.user_info_endpoints() { - tracing::trace!(?endpoint, "Requesting user information from OAuth provider endpoint"); + tracing::trace!( + ?endpoint, + "Requesting user information from OAuth provider endpoint" + ); let mut request = Request::new(Method::GET, endpoint.parse().unwrap()); self.initialize_headers(&mut request);