pub fn spawn_token_refresh_task(
expires_in: u64,
refresh_token: String,
cmd_tx: UnboundedSender<HandlerCommand>,
request_id_counter: Arc<AtomicU64>,
)Expand description
Spawns a background task to refresh the authentication token before it expires.
The task sleeps until 80% of the token lifetime has passed, then sends a refresh request.
When the refresh succeeds, a new Authenticated message will be received, which triggers
another refresh task - creating a continuous refresh cycle.