Skip to content

Commit 17e1da7

Browse files
committed
Simplify JWT creation some more
1 parent 556c76f commit 17e1da7

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/jwt.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ impl<'a> Claims<'a> {
2929
scopes: &[&str],
3030
sub: Option<&'a str>,
3131
) -> Self {
32-
let iat = Utc::now().timestamp();
33-
let expiry = iat + 3600 - 5; // Max validity is 1h.
34-
3532
let mut scope = String::with_capacity(16);
3633
for (i, s) in scopes.iter().enumerate() {
3734
if i != 0 {
@@ -41,10 +38,11 @@ impl<'a> Claims<'a> {
4138
scope.push_str(s);
4239
}
4340

41+
let iat = Utc::now().timestamp();
4442
Claims {
4543
iss: &key.client_email,
4644
aud: &key.token_uri,
47-
exp: expiry,
45+
exp: iat + 3600 - 5, // Max validity is 1h
4846
iat,
4947
sub,
5048
scope,

0 commit comments

Comments
 (0)