pub struct HttpGitHubOAuthProvider { /* private fields */ }Expand description
HTTP implementation of the GitHub device authorization flow (RFC 8628).
Usage:
ⓘ
let provider = HttpGitHubOAuthProvider::new();
let code = provider.request_device_code("Ov23li...", "read:user gist").await?;
let token = provider.poll_for_token("Ov23li...", &code.device_code,
Duration::from_secs(code.interval), Duration::from_secs(code.expires_in)).await?;Implementations§
Trait Implementations§
Source§impl Default for HttpGitHubOAuthProvider
impl Default for HttpGitHubOAuthProvider
Source§impl OAuthDeviceFlowProvider for HttpGitHubOAuthProvider
impl OAuthDeviceFlowProvider for HttpGitHubOAuthProvider
Source§fn request_device_code(
&self,
client_id: &str,
scopes: &str,
) -> impl Future<Output = Result<DeviceCodeResponse, PlatformError>> + Send
fn request_device_code( &self, client_id: &str, scopes: &str, ) -> impl Future<Output = Result<DeviceCodeResponse, PlatformError>> + Send
Request a device code to begin the device authorization flow. Read more
Source§fn poll_for_token(
&self,
client_id: &str,
device_code: &str,
interval: Duration,
expires_in: Duration,
) -> impl Future<Output = Result<String, PlatformError>> + Send
fn poll_for_token( &self, client_id: &str, device_code: &str, interval: Duration, expires_in: Duration, ) -> impl Future<Output = Result<String, PlatformError>> + Send
Poll for the access token until granted, denied, or the lifetime elapses. Read more
Source§fn fetch_user_profile(
&self,
access_token: &str,
) -> impl Future<Output = Result<PlatformUserProfile, PlatformError>> + Send
fn fetch_user_profile( &self, access_token: &str, ) -> impl Future<Output = Result<PlatformUserProfile, PlatformError>> + Send
Fetch the authenticated user’s profile using the access token. Read more
Auto Trait Implementations§
impl Freeze for HttpGitHubOAuthProvider
impl !RefUnwindSafe for HttpGitHubOAuthProvider
impl Send for HttpGitHubOAuthProvider
impl Sync for HttpGitHubOAuthProvider
impl Unpin for HttpGitHubOAuthProvider
impl UnsafeUnpin for HttpGitHubOAuthProvider
impl !UnwindSafe for HttpGitHubOAuthProvider
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