Skip to main content

poll_token_with

Function poll_token_with 

Source
pub async fn poll_token_with<S, F>(
    client: &Client,
    discovery: &Discovery,
    client_id: &str,
    device: &DeviceAuth,
    sleep: S,
) -> Result<TokenSet, OidcError>
where S: FnMut(Duration) -> F, F: Future<Output = ()>,
Expand description

Poll the token endpoint until the user approves, or the attempt dies.

The sleep is a parameter (production passes tokio::time::sleep) for two reasons: tests must not burn wall-clock seconds, and the elapsed budget is accumulated from the sleep durations rather than read off a clock — so “give up after expires_in” is exercised deterministically by a no-op sleep, and a slow_down genuinely shortens the number of remaining attempts.