Overview
The Timeback SDK provides a Next.js adapter for the App Router with route handlers.Installation
Server Setup
Create a Timeback instance:lib/timeback.ts
Route Handler
Create a catch-all route handler:app/api/timeback/[...timeback]/route.ts
| Route | Method | Purpose |
|---|---|---|
/api/timeback/identity/signin | GET | Initiates SSO flow |
/api/timeback/identity/callback | GET | Handles SSO callback |
/api/timeback/identity/signout | GET/POST | Signs out user |
/api/timeback/user/verify | GET | Verifies user session |
/api/timeback/user/me | GET | Fetches user profile |
/api/timeback/activity | POST | Activity tracking endpoint |
Client Provider
Wrap your app with the TimebackProvider:app/providers.tsx
app/layout.tsx
Usage
Use hooks in client components:components/UserStatus.tsx