Skip to main content

poll_for_device_token

Function poll_for_device_token 

Source
pub async fn poll_for_device_token<F, Fut>(
    device: &DeviceAuthorization,
    request_token: F,
    options: &DevicePollOptions,
) -> Result<TokenResponse, AuthError>
where F: FnMut() -> Fut, Fut: Future<Output = Result<TokenResponse, AuthError>>,
Expand description

Poll until the person decides (RFC 8628 section 3.5).

The wait comes before every poll; slow_down adds five seconds to every later wait; authorization_pending waits again; every other error (including access_denied and expired_token) ends the flow and is returned as the service sent it. The device code’s own lifetime is enforced here too: no request is made once the next wait would pass it. A network failure is returned, not retried: call this again with the same authorization to resume.