pub struct AuthClient { /* private fields */ }Expand description
OAuth2 authorization client for Ppoppo Accounts.
Implementations§
Source§impl AuthClient
impl AuthClient
Sourcepub fn new(config: OAuthConfig) -> Self
pub fn new(config: OAuthConfig) -> Self
Create a new Ppoppo Accounts auth client.
Sourcepub fn with_http_client(self, client: Client) -> Self
pub fn with_http_client(self, client: Client) -> Self
Use a custom HTTP client (for connection pool reuse or testing).
Generate an authorization URL with PKCE parameters.
Sourcepub async fn exchange_code(
&self,
code: &str,
code_verifier: &str,
) -> Result<TokenResponse, Error>
pub async fn exchange_code( &self, code: &str, code_verifier: &str, ) -> Result<TokenResponse, Error>
Exchange an authorization code for tokens using PKCE.
§Errors
Returns Error::Http on network failure, or
Error::OAuth if the token endpoint returns an error.
Sourcepub async fn refresh_token(
&self,
refresh_token: &str,
) -> Result<TokenResponse, Error>
pub async fn refresh_token( &self, refresh_token: &str, ) -> Result<TokenResponse, Error>
Exchange a refresh token for new tokens.
§Errors
Returns Error::Http on network failure, or
Error::OAuth if the token endpoint returns an error.
Sourcepub async fn get_user_info(&self, access_token: &str) -> Result<UserInfo, Error>
pub async fn get_user_info(&self, access_token: &str) -> Result<UserInfo, Error>
Fetch user info using an access token.
§Errors
Returns Error::Http on network failure, or
Error::OAuth if the userinfo endpoint returns an error.
Auto Trait Implementations§
impl Freeze for AuthClient
impl !RefUnwindSafe for AuthClient
impl Send for AuthClient
impl Sync for AuthClient
impl Unpin for AuthClient
impl UnsafeUnpin for AuthClient
impl !UnwindSafe for AuthClient
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