refresh tokens now working

Still investigating the best way to do a couple things, but we have something working
This commit is contained in:
Grant Limberg 2021-12-07 16:29:50 -08:00
parent 48b39ab005
commit b3fbbd3124
No known key found for this signature in database
GPG key ID: 2BA62CCABBB4095A
5 changed files with 15 additions and 7 deletions

View file

@ -152,7 +152,7 @@ impl ZeroIDC {
println!("refresh token thread tick, now: {}, exp: {}", systemtime_strftime(now, "[year]-[month]-[day] [hour]:[minute]:[second]"), systemtime_strftime(exp, "[year]-[month]-[day] [hour]:[minute]:[second]"));
let refresh_token = (*inner_local.lock().unwrap()).refresh_token.clone();
if let Some(refresh_token) = refresh_token {
if now >= (exp - Duration::from_secs(15)) {
if now >= (exp - Duration::from_secs(30)) {
let token_response = (*inner_local.lock().unwrap()).oidc_client.as_ref().map(|c| {
let res = c.exchange_refresh_token(&refresh_token)
.request(http_client);
@ -167,6 +167,7 @@ impl ZeroIDC {
Some(id_token) => {
let params = [("id_token", id_token.to_string()),("state", "refresh".to_string())];
println!("New ID token: {}", id_token.to_string());
let client = reqwest::blocking::Client::new();
let r = client.post((*inner_local.lock().unwrap()).auth_endpoint.clone())
.form(&params)