get exp time out of correct token

This commit is contained in:
Grant Limberg 2022-03-29 10:01:02 -07:00
parent 1d92974447
commit 1efceb86fc
No known key found for this signature in database
GPG Key ID: 8F2F97D3BE8D7735

View File

@ -203,6 +203,7 @@ impl ZeroIDC {
}
#[cfg(debug_assertions)] {
println!("now: {:?}\nexp: {:?}", now, exp);
println!("Refresh Token: {}", refresh_token.secret());
}
@ -519,15 +520,17 @@ impl ZeroIDC {
println!("Status: {}", res.status());
}
let at = tok.access_token().secret();
let idt = &id_token.to_string();
let t: Result<Token<jwt::Header, jwt::Claims, jwt::Unverified<'_>>, jwt::Error>= Token::parse_unverified(at);
let t: Result<Token<jwt::Header, jwt::Claims, jwt::Unverified<'_>>, jwt::Error>=
Token::parse_unverified(idt);
if let Ok(t) = t {
let claims = t.claims().registered.clone();
match claims.expiration {
Some(exp) => {
i.exp_time = exp;
println!("Set exp time to: {:?}", i.exp_time);
},
None => {
panic!("expiration is None. This shouldn't happen")