1 unstable release
Uses new Rust 2024
0.2.1 | Mar 5, 2025 |
---|
#607 in Authentication
73KB
1K
SLoC
Magic Link authentication plugin for Torii
This plugin provides magic link authentication functionality, allowing users to sign in by clicking a secure link sent to their email address rather than using a password.
Features
- Generate secure one-time use magic links
- Verify magic link tokens
- Automatic user creation if not exists
- Configurable token expiration
Example
use torii_auth_magic_link::MagicLinkPlugin;
use torii_core::plugin::PluginManager;
// Register the plugin with your PluginManager
let mut plugin_manager = PluginManager::new(user_storage.clone(), session_storage.clone());
plugin_manager.register_plugin(MagicLinkPlugin::new(user_storage.clone()));
// Generate a magic link token
let plugin = plugin_manager.get_plugin::<MagicLinkPlugin>("magic_link").unwrap();
let token = plugin.generate_magic_token("user@example.com").await?;
// Verify the token when user clicks the link
let user = plugin.verify_magic_token(&token.token).await?;
Torii
[!WARNING] This project is in early development and is not production-ready. The API is subject to change without notice.
Overview
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.
With Torii, you get the best of both worlds - powerful authentication capabilities like passwordless login, social OAuth, and passkeys, combined with full data sovereignty and the ability to store user data wherever you choose.
Checkout the example todos to see Torii in action.
Features
Plugin | SQLite | PostgreSQL | MySQL (using SeaORM) |
---|---|---|---|
Password | ✅ | ✅ | ✅ |
OAuth2/OIDC | ✅ | ✅ | ✅ |
Passkey | ✅ | ✅ | ✅ |
Magic Link | ✅ | ✅ | ✅ |
✅ = Supported 🚧 = Planned/In Development ❌ = Not Supported
Security
[!IMPORTANT] As this project is in early development, it has not undergone security audits and should not be used in production environments. The maintainers are not responsible for any security issues that may arise from using this software.
Contributing
As this project is in its early stages, we welcome discussions and feedback, but please note that major changes may occur.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Dependencies
~6–14MB
~155K SLoC