Torii
Torii is a powerful authentication framework for Rust applications that gives you complete control over your users' data. Unlike hosted solutions like Auth0, Clerk, or WorkOS that store user information in their cloud, Torii lets you own and manage your authentication stack while providing modern auth features through a flexible plugin system.
Features
- Password-based authentication
- Social OAuth/OpenID Connect
- Passkey/WebAuthn support
- Full data sovereignty - store user data where you want
- Multiple storage backends:
- SQLite
- Postgres
- MySQL
Quick Start
- Add dependencies to your
Cargo.toml:
[]
= { = "0.2.0", = ["sqlite", "password"] }
- Initialize the database:
let pool = connect.await
.expect;
let user_storage = new;
let session_storage = new;
// Migrate the user storage
user_storage
.migrate
.await
.expect;
// Migrate the session storage
session_storage
.migrate
.await
.expect;
let torii = new.with_password_plugin;
- Create a user:
let user = torii.register_user_with_password.await?;
- Login a user:
let user = torii.login_user_with_password.await?;