atproto-oauth-axum
Axum web framework integration for AT Protocol OAuth.
Overview
Production-ready OAuth handlers for authorization flows, callbacks, JWKS endpoints, and metadata with secure state management.
Features
- OAuth endpoint handlers: Complete Axum handlers for authorization flows, callbacks, and metadata endpoints
- JWKS endpoint: JSON Web Key Set endpoint for public key distribution to authorization servers
- Client metadata: RFC 7591 compliant OAuth client metadata endpoint for dynamic registration
- Callback processing: OAuth authorization callback handler with state validation and token exchange
- State management: Secure OAuth state and request management with Axum extractors
- Error handling: Comprehensive error handling with proper HTTP status codes
CLI Tools
The following command-line tool is available when built with the clap
feature:
atproto-oauth-tool
: Complete OAuth login workflow tool for AT Protocol services with local callback server
Usage
Basic Server Setup
use ;
use ;
let oauth_config = OAuthClientConfig ;
let app = new
.route
.route
.route
.with_state;
OAuth Handlers
The library provides ready-to-use handlers for:
- Client Metadata: Generates RFC 7591 compliant metadata
- JWKS Endpoint: Serves JSON Web Key Sets for signature verification
- Callback Processing: Handles OAuth authorization callbacks with token exchange
Command Line Examples
# Start OAuth login flow for a handle
# Start OAuth login flow for a DID
The tool provides a complete OAuth client implementation with:
- Subject resolution and DID document retrieval
- PDS and authorization server discovery
- PKCE and DPoP parameter generation
- Local web server for callback handling
- Complete token exchange flow
License
MIT License