Skip to main content

redeem_device_code

Function redeem_device_code 

Source
pub async fn redeem_device_code<S, A, R, Authorize, Prepare>(
    endpoint: &EndpointContext<'_, S>,
    code: &str,
    authorize: Authorize,
    prepare: Prepare,
) -> AuthResult<DeviceCodeRedemptionResult<A, R>>
where S: AuthSchema, A: Send + Sync, R: Send, Authorize: for<'a> FnOnce(&'a DeviceCode, &'a EndpointContext<'_, S>) -> DeviceRedemptionFuture<'a, DeviceCodeRedemptionAuthorization<A>> + Send, Prepare: for<'a> FnOnce(&'a DeviceCode, &'a A, &'a EndpointContext<'_, S>) -> DeviceRedemptionFuture<'a, R> + Send,
Expand description

Authorize, prepare, and atomically consume an approved device code.

Callbacks cannot bypass polling, expiry, denial, or consumption guards. Every database operation uses endpoint.transaction when present. Callback errors propagate unchanged; the caller issues credentials only after success. If the caller uses a transaction, issue credentials only after that transaction commits.