"use client"; import React from "react"; import { useAuth } from "../hooks/useAuth"; export default function AuthDemoPage() { const { user, authenticated, loading, logout } = useAuth(); if (loading) { return (

Loading authentication status...

); } return (

🔐 Authentication System Demo

{/* Authentication Status Card */}

Authentication Status

Status: {authenticated ? "✅ Authenticated" : "❌ Not Authenticated"}
{user?.id && (
User ID: {user.id}
)} {user?.email && (
Email: {user.email}
)}
{authenticated && (
)}
{/* Quick Actions Card */}

Quick Actions

🔑 Login Page 👤 Profile Page (Protected) ✅ Check Auth API
{/* Authentication Flow Card */}

🔄 Authentication Flow

1. Token Authentication via URL

GET /api/auth/callback?token=YOUR_SUPABASE_TOKEN&refresh_token=REFRESH_TOKEN&redirect_to=/profile

2. Programmatic Login via POST

POST /api/auth/callback
{`{"access_token": "token", "refresh_token": "refresh"}`}

3. Manual Token Entry

Visit the{" "} login page {" "} to enter your Supabase tokens manually.

{/* API Endpoints Card */}

🚀 Available API Endpoints

Authentication

  • GET /api/auth/check - Check auth status
  • POST /api/auth/callback - Login with tokens
  • POST /api/auth/refresh - Refresh access token
  • POST /api/auth/logout - Logout and clear cookies

Protected Routes

  • GET /api/user - Get user information
  • GET /profile - User profile page
  • GET /chat - Chat interface (if implemented)
  • GET /settings - Settings page (if implemented)

📚 See AUTH_SYSTEM.md for detailed documentation

); }