mirror of
https://github.com/tokio-rs/axum.git
synced 2025-02-17 02:34:28 +01:00
examples(jwt): Claims.exp represents a UTC timestamp (#760)
For the example to work, it should be an epoch value in the future.
See d8a33def00/README.md (L61)
This commit is contained in:
parent
8b551dcbf2
commit
8c0926ee5b
1 changed files with 2 additions and 1 deletions
|
@ -93,7 +93,8 @@ async fn authorize(Json(payload): Json<AuthPayload>) -> Result<Json<AuthBody>, A
|
||||||
let claims = Claims {
|
let claims = Claims {
|
||||||
sub: "b@b.com".to_owned(),
|
sub: "b@b.com".to_owned(),
|
||||||
company: "ACME".to_owned(),
|
company: "ACME".to_owned(),
|
||||||
exp: 100000,
|
// Mandatory expiry time as UTC timestamp
|
||||||
|
exp: 2000000000, // May 2033
|
||||||
};
|
};
|
||||||
// Create the authorization token
|
// Create the authorization token
|
||||||
let token = encode(&Header::default(), &claims, &KEYS.encoding)
|
let token = encode(&Header::default(), &claims, &KEYS.encoding)
|
||||||
|
|
Loading…
Add table
Reference in a new issue