Skip to main content

OAuthProvider

Trait OAuthProvider 

Source
pub trait OAuthProvider: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn authorization_url(&self, state: &str, pkce_challenge: &str) -> String;
    fn exchange_code<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        code: &'life1 str,
        pkce_verifier: &'life2 str,
        redirect_uri: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<OAuthTokens>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn fetch_user_info<'life0, 'life1, 'async_trait>(
        &'life0 self,
        access_token: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<OAuthUserInfo>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}

Required Methods§

Source

fn name(&self) -> &'static str

Source

fn authorization_url(&self, state: &str, pkce_challenge: &str) -> String

Build the provider authorization URL the user should be redirected to.

Source

fn exchange_code<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, code: &'life1 str, pkce_verifier: &'life2 str, redirect_uri: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<OAuthTokens>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Exchange the authorization code for tokens.

Source

fn fetch_user_info<'life0, 'life1, 'async_trait>( &'life0 self, access_token: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<OAuthUserInfo>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch user info using the access token.

Implementors§