Understanding how ShadcnKit secures pages and API routes using Logto
app/[locale]/dashboard/layout.tsx
file acts as a gatekeeper for all dashboard routes.getLogtoContext
to verify if the user is authenticated.lib/auth.ts
file provides utility functions for API authentication.requireAuth
function checks if a user is authenticated and retrieves their information.requireAuth
function to ensure only authenticated users can access them:
lib/auth.ts
to add additional checks or user data retrieval.app/[locale]/dashboard/layout.tsx
for unauthenticated users.requireAuth
function.