pub struct AuthService { /* private fields */ }Expand description
Service for handling authentication flows
Implementations§
Source§impl AuthService
impl AuthService
Sourcepub fn with_auth_url(auth_url: String) -> Self
pub fn with_auth_url(auth_url: String) -> Self
Create a new AuthService with custom auth URL
Sourcepub async fn request_device_code(&self) -> Result<DeviceCodeResponse, AuthError>
pub async fn request_device_code(&self) -> Result<DeviceCodeResponse, AuthError>
Request a new device code for authentication
Returns device code info including user_code and verification_uri
Sourcepub async fn poll_device_code(
&self,
device_code: &str,
) -> Result<DeviceCodeStatus, AuthError>
pub async fn poll_device_code( &self, device_code: &str, ) -> Result<DeviceCodeStatus, AuthError>
Poll for device code status
Should be called at the interval specified in DeviceCodeResponse
Sourcepub async fn run_device_code_flow<F>(
&self,
on_device_code: F,
) -> Result<Credentials, AuthError>where
F: FnOnce(&DeviceCodeResponse),
pub async fn run_device_code_flow<F>(
&self,
on_device_code: F,
) -> Result<Credentials, AuthError>where
F: FnOnce(&DeviceCodeResponse),
Run the complete device code flow
This method:
- Requests a device code
- Returns immediately with device code info (caller should display to user)
- Polls until authorized, denied, or expired
Returns credentials on success
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AuthService
impl !RefUnwindSafe for AuthService
impl Send for AuthService
impl Sync for AuthService
impl Unpin for AuthService
impl !UnwindSafe for AuthService
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
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