oauth-toolkit
Shared OAuth2/OIDC primitives — crypto, PKCE, scopes, CSRF, social login, OIDC, JWKS validation.
Modules
| Module | Purpose |
|---|---|
crypto |
SHA-256 hex, HMAC-SHA256, opaque token generation |
pkce |
RFC 7636 S256 verification |
scope |
Parse/validate OAuth scopes |
redirect |
URI exact-match validation |
csrf |
CsrfStore trait (memory + Redis backends) |
social |
GitHub + Google OAuth2 flows |
oidc |
Discovery, token exchange, user info, refresh |
oidc_validator |
JWKS-backed token validation |
jwt |
HS256 encode/decode helpers |
Quick Start
use ;
// Hash a token for storage
let hash = sha256_hex;
// Generate PKCE pair
let = generate_pkce_pair;
// Build GitHub authorization URL
let config = SocialProviderConfig ;
let url = build_authorize_url;
Contributing
See CONTRIBUTING.md.
License
Licensed under MIT OR Apache-2.0.