From b8ff4bb39c330a55d647505e90afc5aef767f9b1 Mon Sep 17 00:00:00 2001 From: Ali Afroozeh Date: Fri, 28 Jun 2024 03:17:00 +0200 Subject: [PATCH] Make non-recommended JWT claims optional (#50) --- src/validators/authorizer.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/validators/authorizer.rs b/src/validators/authorizer.rs index 05f59f3..afe1e1f 100644 --- a/src/validators/authorizer.rs +++ b/src/validators/authorizer.rs @@ -12,7 +12,7 @@ pub struct ClerkJwt { pub iat: i32, pub iss: String, pub nbf: i32, - pub sid: String, + pub sid: Option, pub sub: String, } @@ -111,7 +111,7 @@ pub fn validate_jwt(token: &str, jwks: JwksModel) -> Result(token, &decoding_key, &validation) { Ok(token) => Ok(token.claims), - _ => Err(ClerkError::Unauthorized(String::from("Error: Invalid JWT!"))), + Err(err) => Err(ClerkError::Unauthorized(format!("Error: Invalid JWT! cause: {}", err))), } } _ => Err(ClerkError::InternalServerError(String::from("Error: Unsupported key algorithm"))),