pub struct OAuthFlow { /* private fields */ }Expand description
OAuth 2.0 authorization code flow handler
Implementations§
Source§impl OAuthFlow
impl OAuthFlow
Sourcepub fn new(config: OAuthConfig) -> Self
pub fn new(config: OAuthConfig) -> Self
Create a new OAuth flow with the given configuration
Sourcepub fn generate_auth_url(&mut self) -> String
pub fn generate_auth_url(&mut self) -> String
Generate the authorization URL for the user to visit
This generates a new PKCE challenge and returns the full authorization URL that should be opened in the user’s browser.
Sourcepub async fn exchange_code(&self, code: &str) -> OAuthResult<TokenResponse>
pub async fn exchange_code(&self, code: &str) -> OAuthResult<TokenResponse>
Exchange authorization code for tokens
The code should be in the format “authorization_code#state” as returned by Anthropic.
Sourcepub async fn refresh_token(
&self,
refresh_token: &str,
) -> OAuthResult<TokenResponse>
pub async fn refresh_token( &self, refresh_token: &str, ) -> OAuthResult<TokenResponse>
Refresh an expired access token
Sourcepub fn pkce_verifier(&self) -> Option<&str>
pub fn pkce_verifier(&self) -> Option<&str>
Get the PKCE verifier (for validation purposes)
Auto Trait Implementations§
impl Freeze for OAuthFlow
impl RefUnwindSafe for OAuthFlow
impl Send for OAuthFlow
impl Sync for OAuthFlow
impl Unpin for OAuthFlow
impl UnwindSafe for OAuthFlow
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