Router

Mount rs-auth into your Axum application.

The rs-auth-axum crate exposes auth_router so you can mount auth routes quickly.

src/main.rs
use axum::Router;
use rs_auth::axum::auth_router;

let app = Router::new().nest("/auth", auth_router(state));

This keeps the integration thin: rs-auth-core owns auth logic and rs-auth-axum owns the HTTP layer.

Public routes

Public routes are accessible without authentication:

MethodPathDescription
POST/auth/signupCreate a new user account
POST/auth/loginLog in with email and password
GET/auth/verify/{token}Verify email with token
POST/auth/forgotRequest password reset
POST/auth/resetReset password with token
GET/auth/login/{provider}Initiate OAuth login
GET/auth/callback/{provider}OAuth callback handler

Protected routes

Protected routes require a valid session (enforced by require_auth middleware):

MethodPathDescription
GET/auth/sessionGet current session information
GET/auth/sessionsList all sessions for current user
POST/auth/logoutLog out and invalidate session
GET/auth/link/{provider}Initiate explicit OAuth account link
GET/auth/accountsList linked OAuth accounts
POST/auth/accounts/{id}/unlinkUnlink an OAuth account

The router splits these into two groups internally, applying require_auth only to protected routes:

On this page