AilitaProvider wrapping your app, AuthGuard protecting a route, LoginForm handling authentication, and useAuth displaying the current user.
What you’ll build
providers.tsx— AilitaProvider wrapper with tenant config(protected)/layout.tsxorProtectedRoute.tsx— AuthGuard route protectionlogin/page.tsxorLoginPage.tsx— Login page with LoginFormdashboard/page.tsxorDashboardPage.tsx— Protected page using useAuth
1
Install and configure
2
Create the Providers wrapper
3
Wrap your root layout
4
Protect a route with AuthGuard
5
Add a login page with LoginForm
LoginForm handles all login states internally: password submission, OTP challenges, TOTP verification, and TOTP setup on first admin login. No additional wiring required for the basic case.6
Read the current user in a protected page
user is null on initial render while the silent refresh runs. AuthGuard ensures this page only renders when isAuthenticated is true, so by the time this component mounts, user will be populated.Next steps
AilitaProvider props
Full prop reference for clientId, baseUrl, onSessionExpired, and more.
AuthGuard patterns
Role-based access, loadingFallback, and the UX-gate security model.

