pub struct SimpleOAuthClient<P> { /* private fields */ }Implementations§
Source§impl<P> SimpleOAuthClient<P>where
P: SimpleOAuthProvider,
impl<P> SimpleOAuthClient<P>where
P: SimpleOAuthProvider,
pub fn builder<'f1>() -> SimpleOAuthClientBuilder<'f1, P>
Build the URL to navigate the user to for authorization. Make sure to save the returned state and PKCE verifier in a secure location, typically in a server-side cache or session.
If scopes are not provided, this will use the provider’s default scopes.
You can optionally override the redirect URL, but make sure to pass in the exact same URL when calling
exchange_code().
Sourcepub fn exchange_code<'f1>(
&'f1 self,
) -> SimpleOAuthClientExchangeCodeBuilder<'f1, P>
pub fn exchange_code<'f1>( &'f1 self, ) -> SimpleOAuthClientExchangeCodeBuilder<'f1, P>
Exchange the returned code after authorization for an access/refresh token. You will need to provide the returned code and the saved PKCE verifier. Make sure to first verify the returned state if applicable.
If you set the redirect URL when calling authorize_url(), you must set the same URL here as well.
Sourcepub fn exchange_refresh_token<'f1>(
&'f1 self,
) -> SimpleOAuthClientExchangeRefreshTokenBuilder<'f1, P>
pub fn exchange_refresh_token<'f1>( &'f1 self, ) -> SimpleOAuthClientExchangeRefreshTokenBuilder<'f1, P>
Exchange the refresh token for a new access token
Source§impl<P> SimpleOAuthClient<P>where
P: UserInfoProvider,
impl<P> SimpleOAuthClient<P>where
P: UserInfoProvider,
Sourcepub async fn get_user_info(
&self,
access_token: &str,
) -> Result<UserInfo, SimpleOAuthError>
pub async fn get_user_info( &self, access_token: &str, ) -> Result<UserInfo, SimpleOAuthError>
Retrieve user info from the provider using the access token. This is a convenience method for providers that support normalized user info (e.g. id, name, email, avatar).
Trait Implementations§
Source§impl<P: Clone> Clone for SimpleOAuthClient<P>
impl<P: Clone> Clone for SimpleOAuthClient<P>
Source§fn clone(&self) -> SimpleOAuthClient<P>
fn clone(&self) -> SimpleOAuthClient<P>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more