America/Toronto
12:34:58
Posts

Create password protected pages

April 17, 2025
To enable password protection for specific pages, add the page paths you want to protect to the protectedRoutes object in the resources/config.js file. The RouteGuard component will automatically handle access control for these pages, requiring password authentication before allowing access.
src/app/resources/config.js
const protectedRoutes = {
'/work/once-ui': true
};
The code above will ensure that the /work/once-ui page is only accessible after providing a password. The password can be set in the .env.local file for local development and as an environment variable for production.