Adding refresh token
This commit is contained in:
+10
-1
@@ -30,11 +30,20 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
|
|
||||||
let mut svc = catapult::service::core::Service {
|
let mut svc = catapult::service::core::Service {
|
||||||
app: app.clone(),
|
app: app.clone(),
|
||||||
token,
|
// Use a pointer
|
||||||
|
token: token.clone(),
|
||||||
};
|
};
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
// catapult::service::do_the_work(&app).await;
|
// catapult::service::do_the_work(&app).await;
|
||||||
|
let refresh_token = match auth.get_refresh_token(&token).await {
|
||||||
|
Ok(refresh) => refresh,
|
||||||
|
Err(err) => {
|
||||||
|
eprintln!("Error: {err:?}");
|
||||||
|
std::process::exit(-1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
println!("Refresh token: {refresh_token:?}");
|
||||||
svc.do_the_work().await;
|
svc.do_the_work().await;
|
||||||
tokio::time::sleep(tokio::time::Duration::from_secs(
|
tokio::time::sleep(tokio::time::Duration::from_secs(
|
||||||
catapult::app::SECONDS_TO_SLEEP,
|
catapult::app::SECONDS_TO_SLEEP,
|
||||||
|
|||||||
@@ -110,6 +110,11 @@ pub mod auth {
|
|||||||
Err(err) => Err(std::io::Error::other(err.to_string())),
|
Err(err) => Err(std::io::Error::other(err.to_string())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn has_token_expired(token: &textsender_models::token::LoginResult) -> bool {
|
||||||
|
todo!("Need to finish this");
|
||||||
|
false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user