clearer error message for unable to exchange refresh token

This commit is contained in:
Ruben Fiszel
2022-10-30 21:35:22 +01:00
parent 331bce472a
commit 9a4bb545cd
2 changed files with 19 additions and 12 deletions
+10 -10
View File
@@ -4267,7 +4267,7 @@ dependencies = [
[[package]]
name = "windmill-api"
version = "1.42.0"
version = "1.42.1"
dependencies = [
"anyhow",
"argon2",
@@ -4314,7 +4314,7 @@ dependencies = [
[[package]]
name = "windmill-api-client"
version = "1.42.0"
version = "1.42.1"
dependencies = [
"base64",
"chrono",
@@ -4329,7 +4329,7 @@ dependencies = [
[[package]]
name = "windmill-audit"
version = "1.42.0"
version = "1.42.1"
dependencies = [
"chrono",
"serde",
@@ -4342,7 +4342,7 @@ dependencies = [
[[package]]
name = "windmill-common"
version = "1.42.0"
version = "1.42.1"
dependencies = [
"anyhow",
"axum",
@@ -4367,7 +4367,7 @@ dependencies = [
[[package]]
name = "windmill-parser"
version = "1.42.0"
version = "1.42.1"
dependencies = [
"serde",
"serde_json",
@@ -4375,7 +4375,7 @@ dependencies = [
[[package]]
name = "windmill-parser-go"
version = "1.42.0"
version = "1.42.1"
dependencies = [
"anyhow",
"itertools",
@@ -4387,7 +4387,7 @@ dependencies = [
[[package]]
name = "windmill-parser-py"
version = "1.42.0"
version = "1.42.1"
dependencies = [
"anyhow",
"itertools",
@@ -4401,7 +4401,7 @@ dependencies = [
[[package]]
name = "windmill-parser-ts"
version = "1.42.0"
version = "1.42.1"
dependencies = [
"anyhow",
"deno_core",
@@ -4415,7 +4415,7 @@ dependencies = [
[[package]]
name = "windmill-queue"
version = "1.42.0"
version = "1.42.1"
dependencies = [
"anyhow",
"chrono",
@@ -4438,7 +4438,7 @@ dependencies = [
[[package]]
name = "windmill-worker"
version = "1.42.0"
version = "1.42.1"
dependencies = [
"anyhow",
"async-recursion",
+9 -2
View File
@@ -477,12 +477,19 @@ pub async fn _refresh_token<'c>(
.client)
.to_owned();
let token = client
let token_json = client
.exchange_refresh_token(&RefreshToken::from(account.refresh_token.clone()))
.with_client(&http_client)
.execute::<TokenResponse>()
.execute::<serde_json::Value>()
.await
.map_err(to_anyhow)?;
let token = serde_json::from_value::<TokenResponse>(token_json.clone()).map_err(|e| {
Error::BadConfig(format!(
"Error deserializing response as a new token: {e}\nresponse:{token_json}"
))
})?;
let expires_at = now_from_db(&mut tx).await?
+ chrono::Duration::seconds(
token