pub struct DeviceAuthFlow { /* private fields */ }Implementations§
Source§impl DeviceAuthFlow
impl DeviceAuthFlow
pub fn new(client_id: impl AsRef<str>) -> Self
Sourcepub async fn request_device_code(&self) -> Result<DeviceCodeResponse>
pub async fn request_device_code(&self) -> Result<DeviceCodeResponse>
Step 1: Request device and user codes from GitHub.
Sourcepub async fn poll_for_token(
&self,
device_code: &DeviceCodeResponse,
notify: Option<UnboundedReceiver<()>>,
) -> Result<AccessTokenResponse>
pub async fn poll_for_token( &self, device_code: &DeviceCodeResponse, notify: Option<UnboundedReceiver<()>>, ) -> Result<AccessTokenResponse>
Step 2+3: Poll GitHub until the user authorizes the device.
This blocks (async sleep) respecting the interval from the device code
response. Backs off on slow_down and stops on expired_token or
access_denied.
An optional notify receiver can be passed to signal the poll loop to
check immediately instead of waiting for the full interval to elapse.
Sourcepub async fn refresh_token(
&self,
refresh_token: &str,
) -> Result<RefreshTokenResponse>
pub async fn refresh_token( &self, refresh_token: &str, ) -> Result<RefreshTokenResponse>
Refresh an expired access token using a refresh token.
Auto Trait Implementations§
impl !RefUnwindSafe for DeviceAuthFlow
impl !UnwindSafe for DeviceAuthFlow
impl Freeze for DeviceAuthFlow
impl Send for DeviceAuthFlow
impl Sync for DeviceAuthFlow
impl Unpin for DeviceAuthFlow
impl UnsafeUnpin for DeviceAuthFlow
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