1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! PKCE OAuth login for Anthropic Claude Pro/Max.
//!
//! Thin wrapper around [`motosan_ai_oauth`] with the Anthropic provider
//! pre-configured.
//!
//! # Usage
//!
//! ```no_run
//! #[tokio::main]
//! async fn main() -> Result<(), anthropic_oauth::Error> {
//! let token = anthropic_oauth::login().await?;
//! // `token.access_token` is a "sk-ant-oat01-*" string usable directly
//! // with motosan_ai's AnthropicProvider (which auto-detects the prefix
//! // and applies Claude Code identity headers).
//! println!("{}", token.access_token);
//! Ok(())
//! }
//! ```
//!
//! # Notes
//!
//! - Requires port 53692 to be free on localhost (registered with Anthropic's
//! Claude Code app).
//! - `client_id` is hardcoded to Anthropic's Claude Code app registration and
//! is not configurable. See the project README for the associated ToS
//! disclosure before depending on this crate.
pub use ;
/// Open a browser-based PKCE login flow and return the resulting OAuth token.
pub async
/// Exchange a stored refresh token for a new [`Token`].
pub async