From 71c4212a903870357ff62bf90343a2fa0aeaac79 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Mon, 20 Apr 2026 10:38:14 -0700 Subject: [PATCH] fix: use POST for oidc token request in authed client (#8883) Co-authored-by: Claude Opus 4.5 --- backend/windmill-common/src/client.rs | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/backend/windmill-common/src/client.rs b/backend/windmill-common/src/client.rs index 1a4f05f3be..730136ac1c 100644 --- a/backend/windmill-common/src/client.rs +++ b/backend/windmill-common/src/client.rs @@ -49,7 +49,31 @@ impl AuthedClient { "{}/api/w/{}/oidc/token/{}", self.base_internal_url, self.workspace, audience ); - make_basic_get_request(self, &url, None, Some("decoding oidc token as json string")).await + let response = self + .force_client + .as_ref() + .unwrap_or(&HTTP_CLIENT) + .post(&url) + .header( + reqwest::header::AUTHORIZATION, + reqwest::header::HeaderValue::from_str(&format!("Bearer {}", self.token))?, + ) + .send() + .await + .map_err(|e| { + tracing::error!("Error requesting oidc token from {url}: {e:#?}"); + anyhow::anyhow!("Error requesting oidc token from {url}: {e:#?}") + })?; + + match response.status().as_u16() { + 200u16 => Ok(response.text().await.context("reading oidc token body")?), + status => { + let body = response.text().await.unwrap_or_default(); + Err(anyhow::anyhow!( + "oidc token request to {url} failed with status {status}: {body}" + )) + } + } } pub async fn get_resource_value(&self, path: &str) -> anyhow::Result {