Rust Authentication with PropelAuth

Rust Authentication with PropelAuth

We’re big fans of Rust here at PropelAuth. We’ve built the majority of our backend in Rust and it’s really helped us ship quickly and confidently.

Today, we are incredibly excited to release the propelauth crate, which you can use to add authentication and authorization to your Rust backend.

We have support built out for Actix and Axum, as well as a generic library that can be used in any other framework.

If you are using Actix, you can now write API routes like this:

// User will automatically return a 401 (Unauthorized) 
//   if a valid access token wasn't provided
async fn whoami(user: User) -> impl Responder {

which will only accept requests from logged-in users.

As PropelAuth is built with B2B/multi-tenant products in mind, you can also make assertions about which organizations the user is in and what roles and permissions they have:

// The org name or ID typically comes from a path/query parameter
let required_org = RequiredOrg::OrgName("Acme Co"); 
let requirements = UserRequirementsInOrg::IsRole("Admin");

// May return a Forbidden error
let org = user.validate_org_membership(required_org, requirements)?;

You can also make API calls for common actions, like creating users, fetching all users within an organization, or creating magic links:

let magic_link = auth.user().create_magic_link(CreateMagicLinkRequest {
    email: "".to_string(),
}).await.expect("Couldn't create magic link");

We can’t wait to see what cool things you’ll build!

If you have any questions, please reach out at