Expand description
Schlussel - Cross-platform OAuth 2.0 with PKCE for CLI applications
This library provides OAuth 2.0 authorization code flow with PKCE (Proof Key for Code Exchange) for command-line applications.
§Features
- OAuth 2.0 authorization code flow with PKCE (RFC 7636)
- Pluggable storage backend
- Thread-safe token refresh with concurrency control
- C FFI for cross-language compatibility
§Example
use schlussel::prelude::*;
use std::sync::Arc;
let storage = Arc::new(MemoryStorage::new());
let config = OAuthConfig {
client_id: "your-client-id".to_string(),
authorization_endpoint: "https://auth.example.com/authorize".to_string(),
token_endpoint: "https://auth.example.com/token".to_string(),
redirect_uri: "http://localhost:8080/callback".to_string(),
scope: Some("read write".to_string()),
device_authorization_endpoint: None,
};
let client = OAuthClient::new(config, storage);
let result = client.start_auth_flow().unwrap();
println!("Authorization URL: {}", result.url);