This is a Next.js project that demonstrates various authentication methods using Descope flows.
- 🔐 Multiple authentication flow types (Magic Link, OTP, Social Login, SSO, Passkeys, etc.)
- 🎛️ Easy switching between different authentication methods
- 🛡️ Protected routes with middleware
- 📱 Modern, responsive UI
- ⚡ Built with Next.js App Router and TypeScript
- Create a free account at Descope Console
- Create a new project
- Copy your Project ID from the project settings
- Copy your Descope Project ID
- Update
.env.local
with your actual Project ID:
NEXT_PUBLIC_DESCOPE_PROJECT_ID=your_actual_project_id_here
pnpm install
pnpm dev
Open http://localhost:3000 with your browser to see the result.
- Home Page: Overview and navigation to demo pages
- Auth Demo (
/auth
): Switch between different authentication flows - Protected Page (
/protected
): Demonstrates session verification
- Sign Up / Sign In
- Magic Link
- OTP (SMS)
- TOTP (Authenticator)
- Social Login
- SSO
- Passkeys
- nOTP (WhatsApp)
- Embedded Link
src/
├── app/
│ ├── auth/page.tsx # Authentication demo page
│ ├── protected/page.tsx # Protected page requiring auth
│ ├── layout.tsx # Root layout with AuthProvider
│ └── page.tsx # Home page
├── components/
│ └── AuthFlowSwitcher.tsx # Main component for switching flows
└── middleware.ts # Route protection middleware