TktPlz uses JWT tokens stored in an HttpOnly cookie for authentication. Tokens are issued after OTP verification or Google OAuth. The cookie is namedDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Sumitbose5/tktplz/llms.txt
Use this file to discover all available pages before exploring further.
tktplz_cookie and must be included in every request to a protected endpoint. Requests must set credentials: 'include' (fetch) or withCredentials: true (axios) so the browser includes the cookie automatically.
Login flow
Authentication is a two-step process: request an OTP, then verify it.Step 1 — request an OTP
OTP requests are rate-limited to one per email per 60 seconds.
Step 2 — verify the OTP
tktplz_cookie HttpOnly cookie and returns:
Registration
New accounts require the same two-step OTP flow, called through registration endpoints instead.Display name of the user or organiser.
Email address. An OTP is sent here.
Phone number — required for organiser registration only.
/api/auth/verify-otp with the OTP received by email.
Google OAuth
Redirect the user to:/api/auth/google/callback, where the server sets tktplz_cookie and redirects the browser to the frontend. To retrieve the decoded user after the redirect, call:
Admin login
Admins authenticate with email, password, and a TOTP token from an authenticator app.Logout
tktplz_cookie cookie and returns { "success": true, "message": "Logged out successfully" }.
Roles
The JWT payload contains arole field. The three roles are:
| Role | Access level |
|---|---|
user | Book tickets, manage orders, submit issues |
organiser | Create events, view dashboard and analytics, scan QR codes |
moderator | Full admin access — manage events, payouts, and admin invites |
isOrganiser middleware accept both organiser and moderator roles. The isAdmin middleware accepts only moderator.
Common auth errors
| Status | Cause |
|---|---|
401 | Cookie missing, token expired, or signature invalid |
401 | Role does not satisfy the required permission level |
429 | OTP requested within the last 60 seconds |
