pub struct OAuthClient { /* private fields */ }Expand description
OAuth client for handling authentication flows
Implementations§
Source§impl OAuthClient
impl OAuthClient
Sourcepub fn new(provider: OAuthProvider, config: OAuthConfig) -> Self
pub fn new(provider: OAuthProvider, config: OAuthConfig) -> Self
Create a new OAuth client for the specified provider
Sourcepub fn with_defaults(provider: OAuthProvider) -> Result<Self, OAuthError>
pub fn with_defaults(provider: OAuthProvider) -> Result<Self, OAuthError>
Create an OAuth client with default configuration for a provider
Sourcepub async fn start_device_code_flow(
&self,
) -> Result<DeviceCodeResponse, OAuthError>
pub async fn start_device_code_flow( &self, ) -> Result<DeviceCodeResponse, OAuthError>
Start device code flow
Sourcepub async fn poll_for_token(
&self,
device_code: &str,
interval: Duration,
timeout: Duration,
) -> Result<OAuthToken, OAuthError>
pub async fn poll_for_token( &self, device_code: &str, interval: Duration, timeout: Duration, ) -> Result<OAuthToken, OAuthError>
Poll for token completion (device code flow)
Sourcepub async fn refresh_token(
&self,
refresh_token: &str,
) -> Result<OAuthToken, OAuthError>
pub async fn refresh_token( &self, refresh_token: &str, ) -> Result<OAuthToken, OAuthError>
Refresh an expired token
Sourcepub fn provider(&self) -> OAuthProvider
pub fn provider(&self) -> OAuthProvider
Get the provider type
Auto Trait Implementations§
impl !RefUnwindSafe for OAuthClient
impl !UnwindSafe for OAuthClient
impl Freeze for OAuthClient
impl Send for OAuthClient
impl Sync for OAuthClient
impl Unpin for OAuthClient
impl UnsafeUnpin for OAuthClient
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more