Expand description
OAuth2 server and personal access tokens for Rust applications.
rustbasic-passport is a port of laravel/passport
to the Rust ecosystem. It provides:
authorization_codegrant with PKCE (S256 / plain)passwordgrantclient_credentialsgrantrefresh_tokengrant with rotation- Device Authorization grant (RFC 8628):
issue_device_code+approve_device_code personal_accessgrant andcreate_personal_access_token- per-client
grant_types(Passport 13.x schema) - JWT access tokens signed with RS256 (RFC 7519), revoked via the token store
- an optional
axumintegration: routes and auth / scope middleware - an optional
locointegration: loco.rsRoutes/Initializer
let stores = StoreBundle::new(clients, tokens, auth_codes, refresh_tokens, device_codes, users);
let server = PassportServer::new(stores, SigningKey::generate("default")?, Config::default());
let response = server.issue_token(&TokenRequest {
grant_type: Some("password".into()),
client_id: Some("web".into()),
client_secret: Some("secret".into()),
username: Some("user@example.com".into()),
password: Some("password".into()),
..Default::default()
}).await?;Complete working examples: examples/in_memory.rs (full flow, no framework) and
examples/axum_server.rs (axum middleware + routes).