aether-auth
OAuth credential storage and authorization flows for Aether. Provides a pluggable credential storage trait, an OS-keychain-backed implementation, and an end-to-end OAuth authorization-code flow for MCP servers.
Table of Contents
Key Types
OAuthCredentialStorage-- Trait for persisting OAuth credentials keyed by provider ID, MCP server ID, or another credential key.OAuthCredential-- Access token, refresh token, client ID, and expiry timestamp for a single OAuth identity.OAuthHandler-- Trait implemented by consuming applications to drive the OAuth UI/UX (open a browser, wait for the redirect).BrowserOAuthHandler-- DefaultOAuthHandlerthat opens the system browser and listens on a dynamic local port.OsKeyringStore--OAuthCredentialStoragebacked by the OS keychain (macOS Keychain, Windows Credential Manager, Linux/FreeBSD Secret Service). Available under thekeyringfeature.FakeOAuthCredentialStore-- In-memoryOAuthCredentialStoragefor tests.McpCredentialStore-- Per-server adapter that binds anOAuthCredentialStorageto one MCP server ID and implementsrmcp::transport::auth::CredentialStore. Available under themcpfeature.OAuthError-- Error enum returned by every fallible API in this crate.
Usage
Implement OAuthCredentialStorage for your own backend, or use the OS keychain store under the keyring feature:
use ;
# async
For MCP servers that require OAuth, the mcp feature provides perform_oauth_flow, which orchestrates the full authorization-code flow (browser launch, callback capture, token exchange, credential storage) and create_auth_manager_from_store, which builds an rmcp::transport::auth::AuthorizationManager from stored credentials with automatic token refresh.
Feature Flags
| Feature | Description | Default |
|---|---|---|
keyring |
OsKeyringStore backed by the platform's native keychain |
no |
mcp |
MCP credential store, authorization-code flow, and AuthorizationManager integration via rmcp |
no |
License
MIT