Skip to main content

cached_access_token

Function cached_access_token 

Source
pub(crate) fn cached_access_token(state: &CliState) -> Option<String>
Expand description

The cached access token, if it is still good.

Returns None once the token is within TOKEN_EXPIRY_MARGIN_SECS of expiring, or when its lifetime is unknown, so the caller fetches a new one. Without this the first cached token was reused for the life of the process, which a one-shot CLI command never notices and a long-running one – the MLLP listener – fails on for every request after expiry.