pub struct DeviceFlow { /* private fields */ }Expand description
Orchestrates the Device Authorization Flow (RFC 8628).
Implementations§
Source§impl DeviceFlow
impl DeviceFlow
Sourcepub fn new(
client_id: String,
device_authorization_url: String,
token_url: String,
) -> Self
pub fn new( client_id: String, device_authorization_url: String, token_url: String, ) -> Self
Creates a new DeviceFlow instance.
Initiates the device authorization request.
Returns a DeviceAuthorizationResponse which contains the codes and URIs
to be displayed to the user.
Sourcepub async fn poll_for_token(
&self,
device_code: &str,
interval: Option<u64>,
) -> Result<OAuthToken, AuthError>
pub async fn poll_for_token( &self, device_code: &str, interval: Option<u64>, ) -> Result<OAuthToken, AuthError>
Polls the token endpoint until an access token is granted or an error occurs.
This function respects the interval specified by the provider and handles
common device flow errors like authorization_pending and slow_down.
Auto Trait Implementations§
impl Freeze for DeviceFlow
impl !RefUnwindSafe for DeviceFlow
impl Send for DeviceFlow
impl Sync for DeviceFlow
impl Unpin for DeviceFlow
impl !UnwindSafe for DeviceFlow
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more