mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-05 00:03:08 +00:00
fix: use POST for oidc token request in authed client (#8883)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
12c08cc95c
commit
71c4212a90
@@ -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<T: DeserializeOwned>(&self, path: &str) -> anyhow::Result<T> {
|
||||
|
||||
Reference in New Issue
Block a user