pub struct OAuthAuthorizationCode { /* private fields */ }Expand description
OAuth 2.0 Authorization Code token provider with PKCE.
Handles the interactive browser-based login flow and provides automatic token caching and refresh.
Implementations§
Source§impl OAuthAuthorizationCode
impl OAuthAuthorizationCode
Sourcepub async fn start(
server_url: &str,
scopes: &[&str],
) -> Result<Self, OAuthClientError>
pub async fn start( server_url: &str, scopes: &[&str], ) -> Result<Self, OAuthClientError>
Start an OAuth Authorization Code flow.
Discovers the authorization server, generates PKCE parameters, starts a local callback server, and returns a provider ready for the user to authorize.
After calling this, open authorization_url()
in the user’s browser, then call wait_for_callback().
Sourcepub async fn start_with_config(
server_url: &str,
scopes: &[&str],
config: OAuthAuthCodeConfig,
) -> Result<Self, OAuthClientError>
pub async fn start_with_config( server_url: &str, scopes: &[&str], config: OAuthAuthCodeConfig, ) -> Result<Self, OAuthClientError>
Start with custom configuration.
Get the authorization URL to open in the user’s browser.
Sourcepub async fn wait_for_callback(&self) -> Result<(), OAuthClientError>
pub async fn wait_for_callback(&self) -> Result<(), OAuthClientError>
Wait for the OAuth callback and exchange the authorization code for tokens.
This blocks until the user completes the browser-based authorization or the callback times out.
Sourcepub async fn wait_for_callback_with_timeout(
&self,
timeout: Duration,
) -> Result<(), OAuthClientError>
pub async fn wait_for_callback_with_timeout( &self, timeout: Duration, ) -> Result<(), OAuthClientError>
Wait for callback with a custom timeout.
Trait Implementations§
Source§impl Clone for OAuthAuthorizationCode
impl Clone for OAuthAuthorizationCode
Source§fn clone(&self) -> OAuthAuthorizationCode
fn clone(&self) -> OAuthAuthorizationCode
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OAuthAuthorizationCode
impl Debug for OAuthAuthorizationCode
Auto Trait Implementations§
impl !RefUnwindSafe for OAuthAuthorizationCode
impl !UnwindSafe for OAuthAuthorizationCode
impl Freeze for OAuthAuthorizationCode
impl Send for OAuthAuthorizationCode
impl Sync for OAuthAuthorizationCode
impl Unpin for OAuthAuthorizationCode
impl UnsafeUnpin for OAuthAuthorizationCode
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