Expand description
OAuth 2.0 authentication support for LLM providers
This module provides OAuth authentication support for various LLM providers, starting with Anthropic Claude Pro/Max subscriptions.
§Architecture
config: OAuth configuration typeserror: Error types for OAuth operationsflow: OAuth 2.0 authorization code flow implementationpkce: PKCE (Proof Key for Code Exchange) implementationprovider: OAuth provider trait and typesproviders: Concrete provider implementationsregistry: Provider registry for managing providers
§Example
ⓘ
use stakpak_shared::oauth::{OAuthFlow, ProviderRegistry};
// Get the Anthropic provider
let registry = ProviderRegistry::new();
let provider = registry.get("anthropic").unwrap();
// Get OAuth config for Claude Pro/Max
let config = provider.oauth_config("claude-max").unwrap();
// Start the OAuth flow
let mut flow = OAuthFlow::new(config);
let auth_url = flow.generate_auth_url();
// User visits auth_url, gets code, then:
// let tokens = flow.exchange_code(code).await?;
// let auth = provider.post_authorize("claude-max", &tokens).await?;Re-exports§
pub use config::OAuthConfig;pub use error::OAuthError;pub use error::OAuthResult;pub use flow::OAuthFlow;pub use flow::TokenResponse;pub use pkce::PkceChallenge;pub use provider::AuthMethod;pub use provider::AuthMethodType;pub use provider::OAuthProvider;pub use providers::AnthropicProvider;pub use registry::ProviderRegistry;