pub struct ClaudeCodeOAuthProvider { /* private fields */ }Expand description
Resolve credentials from a CredentialStore backend,
refreshing the access token via the Anthropic console token
endpoint when expiry is imminent.
Concurrent refresh attempts are serialised through an internal mutex — refresh tokens may rotate on every grant, so two in-flight refresh calls would race each other into rejection.
Implementations§
Source§impl ClaudeCodeOAuthProvider
impl ClaudeCodeOAuthProvider
Sourcepub fn new(store: impl CredentialStore) -> Self
pub fn new(store: impl CredentialStore) -> Self
Build a provider over the supplied store backend with the canonical Anthropic console token endpoint.
Sourcepub fn with_config(
store: impl CredentialStore,
config: ClaudeCodeOAuthConfig,
) -> Self
pub fn with_config( store: impl CredentialStore, config: ClaudeCodeOAuthConfig, ) -> Self
Build a provider with an explicit config (custom token URL, refresh timeout, …).
Trait Implementations§
Source§impl CredentialProvider for ClaudeCodeOAuthProvider
impl CredentialProvider for ClaudeCodeOAuthProvider
Source§fn resolve<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Credentials>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn resolve<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Credentials>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Resolve current credentials. Long-running impls should respect
tokio cancellation in their internals; the transport supplies the
ExecutionContext indirectly via the surrounding async task.Auto Trait Implementations§
impl !Freeze for ClaudeCodeOAuthProvider
impl !RefUnwindSafe for ClaudeCodeOAuthProvider
impl Send for ClaudeCodeOAuthProvider
impl Sync for ClaudeCodeOAuthProvider
impl Unpin for ClaudeCodeOAuthProvider
impl UnsafeUnpin for ClaudeCodeOAuthProvider
impl !UnwindSafe for ClaudeCodeOAuthProvider
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