pub trait OAuthClient {
// Required methods
fn get_client(&self) -> Result<BasicClient, OauthError>;
fn get_state(&self) -> Option<StateAuth>;
fn generate_url<'async_trait, F, Fut>(
self,
scopes: Vec<String>,
save: F,
) -> Pin<Box<dyn Future<Output = Result<Box<Self>, OauthError>> + Send + 'async_trait>>
where F: FnOnce(StateAuth) -> Fut + Send + 'async_trait,
Fut: Future<Output = ()> + Send + 'async_trait,
Self: 'async_trait;
fn generate_token<'life0, 'async_trait>(
&'life0 self,
code: String,
verifier: String,
) -> Pin<Box<dyn Future<Output = Result<String, OauthError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
OAuthClient is the main struct of the lib, it will handle all the connection with the provider
Required Methods§
fn get_client(&self) -> Result<BasicClient, OauthError>
Sourcefn generate_url<'async_trait, F, Fut>(
self,
scopes: Vec<String>,
save: F,
) -> Pin<Box<dyn Future<Output = Result<Box<Self>, OauthError>> + Send + 'async_trait>>
fn generate_url<'async_trait, F, Fut>( self, scopes: Vec<String>, save: F, ) -> Pin<Box<dyn Future<Output = Result<Box<Self>, OauthError>> + Send + 'async_trait>>
Generate the URL to redirect the user to the provider
§Arguments
scopes
- Vec- The scopes that you want to access in the provider save
- F - The function that will use to save your state in the db/memory
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.