Overview
The Timeback SDK provides an Express middleware adapter. The catch-all route below uses Express 5 path syntax.Installation
Server Setup
Create a server-only Timeback instance. The session helpers below belong to your application: persist the callback user in your authenticated session, and return that session user (includingemail) or null from getUser. These helpers are not SDK exports. Keep API and SSO secrets on the server:
lib/timeback.ts
Middleware
Add the Timeback middleware to your Express app:server.ts
Alternative: Mount on Router
For more control, you can mount routes on an Express Router:server.ts
Routes
The middleware handles these routes under/api/timeback:
Usage
Beyond the HTTP routes, you can use the Timeback instance directly for server-side operations like verifying users, fetching profiles, or recording activity completions:server.ts
See user profile for full documentation on
verify() and getProfile().With Frontend Framework
When using Express with a frontend framework like React:server.ts
Next Steps
React Client
Client-side React integration
Identity
Authentication options
Custom Activities
Track learning sessions