pub struct SimpleOAuthClient<P> { /* private fields */ }Implementations§
Source§impl<P> SimpleOAuthClient<P>where
P: SimpleOAuthProvider,
impl<P> SimpleOAuthClient<P>where
P: SimpleOAuthProvider,
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 when you only need basic info (e.g. id, name, email, avatar).
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, will use default limited scopes for the provider to access basic user info (user ID and name only). If more access is needed (e.g. email), make sure to specify all required 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, 'f2, 'f3>(
&'f1 self,
) -> SimpleOAuthClientExchangeCodeBuilder<'f1, 'f2, 'f3, P>
pub fn exchange_code<'f1, 'f2, 'f3>( &'f1 self, ) -> SimpleOAuthClientExchangeCodeBuilder<'f1, 'f2, 'f3, P>
Exchange the returned code after authorization for an access/refresh token. Along with the returned code and state, you will need to specify the saved PKCE verifier and initial state (the state will be verified using a timing-resistant algorithm).
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
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