Skip to main content

refresh_token_after_delay

Function refresh_token_after_delay 

Source
pub async fn refresh_token_after_delay(
    expires_in: u64,
    refresh_token: String,
    cmd_tx: UnboundedSender<HandlerCommand>,
    cancel_token: CancellationToken,
)
Expand description

Refreshes the authentication token after 80% of its lifetime has elapsed.

When the refresh succeeds, a new Authenticated message will be received, which triggers another delayed refresh and creates a continuous refresh cycle.

The cancel_token allows the owning handler to cancel a stale refresh when a new authentication cycle begins.