Skip to content

Latest commit

 

History

61 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Warning

RustAuth is no longer maintained.

No new releases, bug fixes, or security updates are planned. Please do not adopt RustAuth for new production systems.

For a Rust alternative, you can evaluate better-auth-rs. It is an independent implementation inspired by Better Auth, and its v1 work is alpha. Check feature parity and migration requirements before using it as a replacement.

RustAuth is MIT-licensed. You are welcome to fork or clone it and continue maintaining your own version under the license terms. Please clearly identify maintained forks and any published crates as community-maintained.

Previously published crate versions remain available but receive no support.

RustAuth

RustAuth is an unofficial Rust authentication toolkit inspired by Better Auth. It is server-first: sessions, OAuth/OIDC, SSO, SCIM, SAML, passkeys, plugins, storage adapters, and Axum and Actix Web integrations live in the rustauth-* crates.

0.3.0 adds Actix Web integration, Diesel storage adapters, and CLI breaking changes. The API is pre-1.0; breaking changes are still possible before 1.0.

Quick start

use rustauth::prelude::*;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let auth = RustAuth::builder()
        .secret("secret-a-at-least-32-chars-long!!")
        .base_url("https://app.example.com/api/auth")
        .build()
        .await?;

    Ok(())
}

Mount into Axum with rustauth-axum or Actix Web with rustauth-actix-web:

use rustauth_axum::RustAuthAxumExt;

let app = auth.mount_at_base_path(RustAuthAxumOptions::default())?;
use rustauth_actix_web::RustAuthActixWebExt;

let scope = auth.mount_at_base_path(RustAuthActixWebOptions::default())?;

Run rustauth init --framework axum or rustauth init --framework actix-web to create rustauth.toml, keep [plugins].enabled in sync with the plugins you register in Rust, then rustauth db migrate --yes before serving traffic. See docs/database-migrations.md.

Packages

Start with the umbrella rustauth crate — its README links every rustauth-* package (core, axum, actix-web, cli, plugins, OAuth, SSO, SCIM, adapters, and more).

Database adapters

SQLx (rustauth-sqlx) is the primary adapter family for SQLite, Postgres, and MySQL. For apps that already use Diesel, rustauth-diesel provides Postgres and MySQL adapters via diesel-async. Native Postgres pools are also available through rustauth-tokio-postgres and rustauth-deadpool-postgres.

Docs and parity

Repository

Source: salasebas/rustauth

Testing

cargo install --locked cargo-nextest
./scripts/ensure-test-services.sh postgres mysql redis valkey
cargo nextest run --workspace --all-features
cargo test --workspace --doc --all-features

License

MIT — see LICENSE.

About

Resources

Code of conduct

Contributing

Security policy

Stars

13 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages