pub struct OAuthClient { /* private fields */ }Expand description
OAuth client used to start authorization flows and exchange tokens.
Implementations§
Source§impl OAuthClient
impl OAuthClient
pub fn new( client_id: impl Into<String>, client_secret: OAuthClientSecret, ) -> Result<Self>
pub fn with_http_client( client_id: impl Into<String>, client_secret: OAuthClientSecret, http: Client, ) -> Result<Self>
pub fn with_endpoints(self, authorize_url: Url, token_url: Url) -> Self
pub fn client_id(&self) -> &str
pub fn token_url(&self) -> &Url
Builds an authorization-code flow URL for the given redirect URI and scopes.
pub fn implicit_url( &self, redirect_uri: impl AsRef<str>, scopes: impl IntoIterator<Item = OAuthScope>, ) -> Result<Url>
pub fn implicit_url_with_state( &self, redirect_uri: impl AsRef<str>, scopes: impl IntoIterator<Item = OAuthScope>, state: impl Into<String>, ) -> Result<Url>
Sourcepub async fn exchange_code(
&self,
code: impl Into<String>,
redirect_uri: impl Into<String>,
) -> Result<OAuthTokenResponse>
pub async fn exchange_code( &self, code: impl Into<String>, redirect_uri: impl Into<String>, ) -> Result<OAuthTokenResponse>
Exchanges an authorization code for access and optional refresh tokens.
Sourcepub async fn refresh_access_token(
&self,
refresh_token: &OAuthRefreshToken,
) -> Result<OAuthTokenResponse>
pub async fn refresh_access_token( &self, refresh_token: &OAuthRefreshToken, ) -> Result<OAuthTokenResponse>
Refreshes an access token using a stored refresh token.
Trait Implementations§
Source§impl Clone for OAuthClient
impl Clone for OAuthClient
Source§fn clone(&self) -> OAuthClient
fn clone(&self) -> OAuthClient
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for OAuthClient
impl !UnwindSafe for OAuthClient
impl Freeze for OAuthClient
impl Send for OAuthClient
impl Sync for OAuthClient
impl Unpin for OAuthClient
impl UnsafeUnpin for OAuthClient
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