import { requireAuth } from '../lib/auth.server'; import type { Route } from './+types/dashboard'; export function meta({}: Route.MetaArgs) { return [{ title: 'Dashboard | The Biergarten App' }]; } export async function loader({ request }: Route.LoaderArgs) { const auth = await requireAuth(request); return { username: auth.username, userAccountId: auth.userAccountId, }; } export default function Dashboard({ loaderData }: Route.ComponentProps) { const { username, userAccountId } = loaderData; return (

Welcome, {username}!

You are successfully authenticated. This is a protected page that requires a valid session.

Session Info

Username
{username}
User ID
{userAccountId}

Auth Flow Demo

This demo showcases the following authentication features:

  • Login

    POST to /api/auth/login with username & password

  • Register

    POST to /api/auth/register with full user details

  • Session

    JWT access & refresh tokens stored in an HTTP-only cookie

  • Protected Routes

    This dashboard requires authentication via{' '} requireAuth()

  • Token Refresh

    POST to /api/auth/refresh with refresh token

); }