From 8c0926ee5be2e51bee65976bead07f73b273f50f Mon Sep 17 00:00:00 2001 From: frobiac Date: Tue, 15 Feb 2022 22:43:31 +0100 Subject: [PATCH] examples(jwt): Claims.exp represents a UTC timestamp (#760) For the example to work, it should be an epoch value in the future. See https://github.com/Keats/jsonwebtoken/blob/d8a33def00a61bab12aa5e94ff76d3043d4d474e/README.md?plain=1#L61 --- examples/jwt/src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/jwt/src/main.rs b/examples/jwt/src/main.rs index 56ecf008..5cae685b 100644 --- a/examples/jwt/src/main.rs +++ b/examples/jwt/src/main.rs @@ -93,7 +93,8 @@ async fn authorize(Json(payload): Json) -> Result, A let claims = Claims { sub: "b@b.com".to_owned(), company: "ACME".to_owned(), - exp: 100000, + // Mandatory expiry time as UTC timestamp + exp: 2000000000, // May 2033 }; // Create the authorization token let token = encode(&Header::default(), &claims, &KEYS.encoding)