pub struct AuthorizationFlow { /* private fields */ }Expand description
The OAuth 2.0 authorization code flow with PKCE.
Implementations§
Source§impl AuthorizationFlow
impl AuthorizationFlow
pub fn new( config: OAuthConfig, http: Arc<dyn HttpClient>, clock: Arc<dyn Clock>, ) -> Self
Sourcepub fn begin(
&self,
redirect_uri: impl Into<String>,
) -> Result<PendingAuthorization>
pub fn begin( &self, redirect_uri: impl Into<String>, ) -> Result<PendingAuthorization>
Build the URL to send the user to.
redirect_uri comes from an already-listening RedirectListener.
Sourcepub async fn exchange(
&self,
pending: &PendingAuthorization,
code: &AuthorizationCode,
) -> Result<TokenSet>
pub async fn exchange( &self, pending: &PendingAuthorization, code: &AuthorizationCode, ) -> Result<TokenSet>
Trade the authorization code for tokens.
Sourcepub async fn refresh(&self, refresh_token: &str) -> Result<TokenSet>
pub async fn refresh(&self, refresh_token: &str) -> Result<TokenSet>
Exchange a refresh token for a new access token.
Run the whole flow: open the browser, wait for the redirect, exchange the code.
Trait Implementations§
Source§impl Clone for AuthorizationFlow
impl Clone for AuthorizationFlow
Source§fn clone(&self) -> AuthorizationFlow
fn clone(&self) -> AuthorizationFlow
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 moreAuto Trait Implementations§
impl !RefUnwindSafe for AuthorizationFlow
impl !UnwindSafe for AuthorizationFlow
impl Freeze for AuthorizationFlow
impl Send for AuthorizationFlow
impl Sync for AuthorizationFlow
impl Unpin for AuthorizationFlow
impl UnsafeUnpin for AuthorizationFlow
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