anthropic-oauth 0.1.0

OAuth login for Anthropic Claude Pro/Max (Claude Code session)
Documentation

PKCE OAuth login for Anthropic Claude Pro/Max.

Thin wrapper around [motosan_ai_oauth] with the Anthropic provider pre-configured.

Usage

#[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.