Skip to main content

run_device_flow

Function run_device_flow 

Source
pub async fn run_device_flow(
    client: &Client,
    ep: &OAuthEndpoints,
    on_prompt: impl FnOnce(&DeviceAuthorization),
) -> Result<McpOAuthTokens, Error>
Expand description

The whole non-interactive device-code flow: start authorization, invoke on_prompt exactly once with the DeviceAuthorization (so the caller can print verification_uri/user_code for the user), then poll until authorized/denied/expired — bounded by expires_in_secs, sleeping interval_secs between attempts (never faster, per RFC 8628’s slow_down semantics — a slow_down response widens the interval by a further 5s, same as the spec recommends).