Auth Module API & Integration Guide
Endpoint reference for admin auth and customer mobile auth — login, refresh, sessions, password reset, and verification.
Auth - API & Integration Guide
1. Route Surfaces
Auth is split across two surfaces:
- Admin / backoffice auth:
/api/auth/* - Customer mobile auth:
/api/mobile/auth/*
Accounts are created by an administrator through the Users and Team modules. There is no
self-service registration and no self-service account deletion. banned is the only account
control.
2. Endpoint Reference
2.1 Admin auth (/api/auth/*)
| Method | Path | Auth | Description |
|---|---|---|---|
| POST | /api/auth/login/email | Public | Admin email/password login |
| POST | /api/auth/password/forgot | Public | Request password reset |
| POST | /api/auth/password/reset | Public | Reset password via token or OTP |
| POST | /api/auth/password/set | JWT | Set or change password for authenticated user |
| POST | /api/auth/email/verify/resend | Public | Resend email verification |
| POST | /api/auth/email/verify/confirm | Public | Confirm email verification |
| POST | /api/auth/refresh | Public | Rotate refresh/access tokens |
| GET | /api/auth/me | JWT | Get current user profile (includes hasPassword) |
| GET | /api/auth/permissions | JWT | Get current user permissions |
| POST | /api/auth/phone/verify/request | JWT | Send phone verification OTP |
| POST | /api/auth/phone/verify/confirm | JWT | Confirm phone verification OTP |
| DELETE | /api/auth/logout | JWT | Logout current session |
2.2 Customer mobile auth (/api/mobile/auth/*)
| Method | Path | Auth | Description |
|---|---|---|---|
| POST | /api/mobile/auth/login/email | Public | Customer email/password login |
| POST | /api/mobile/auth/refresh | Public | Rotate refresh/access tokens |
| POST | /api/mobile/auth/password/forgot | Public | Request password reset |
| POST | /api/mobile/auth/password/reset | Public | Reset password via token or OTP |
| POST | /api/mobile/auth/password/set | JWT | Set password for authenticated mobile user |
| POST | /api/mobile/auth/email/verify/resend | Public | Resend email verification |
| POST | /api/mobile/auth/email/verify/confirm | Public | Confirm email verification |
| GET | /api/mobile/auth/me | JWT | Get current user profile (includes hasPassword) |
| DELETE | /api/mobile/auth/logout | JWT | Logout current session |
3. Key Contracts
3.1 Customer email login
POST /api/mobile/auth/login/email
{
"email": "customer@example.com",
"password": "StrongPass123",
"deviceInfo": {
"deviceId": "android-abc",
"deviceType": "android",
"deviceName": "Pixel"
}
}3.2 Password reset, and account invitations
POST /api/auth/password/reset and POST /api/mobile/auth/password/reset redeem
an emailed credential and set a password. Send either token or otp, never
neither:
| Field | Type | Required | Notes |
|---|---|---|---|
token | string | One of token/otp | The value from the emailed link |
otp | string | One of token/otp | Exactly six digits |
email | string | With otp, if no phone | Identifies whose code this is |
phone | string | With otp, if no email | E.164; validated on the way in |
password | string | Yes | 8-32 characters, and must satisfy the strong-password rule |
token accepts either account-entry purpose — a password_reset or an
account_invite. Somebody who has been sent a link cannot tell which of the two
they hold, and both mean the same thing from their side: choose a password. An
invitation is valid for 7 days; a reset for the OTP expiry, 15 minutes by default.
otp accepts password_reset only. Account invitations are redeemable by
link only. The code is not printed in the invitation email, and the OTP lookup
matches on purpose and person without a token hash to tell two live records apart
— so accepting both purposes there could check a correct code against the wrong
record, fail, and spend one of the five attempts that retire it.
Redeeming either credential retires the person's other account-entry credential, so an invitation and an administrator-issued reset cannot both stay usable once one of them has set a password.
Errors:
400 AUTH_PASSWORD_RESET_INPUT_REQUIRED— neithertokennorotpwas sent400 AUTH_OTP_REQUIRED— the OTP branch was taken with nootp400 AUTH_OTP_TARGET_REQUIRED—otpsent with neitheremailnorphone400 AUTH_VERIFICATION_CODE_INVALID— the token or code is unknown, expired, already redeemed, or was retired by the person redeeming their other link. Ask for a fresh link rather than retrying this one.
Every successful reset notifies the account holder by email, including one they asked for themselves. That notification is the only signal a person gets that somebody else changed their password, so it is not suppressed for the expected case. Delivery failure never rolls back the password change.
4. Set Password
Authenticated endpoints for setting or changing a user's password.
4.1 POST /api/auth/password/set
4.2 POST /api/mobile/auth/password/set
Set or change password for an authenticated user.
Authentication: JWT Bearer token
Rate limit: 5 requests per 15 minutes
Request body:
{
"newPassword": "NewPass@1234",
"currentPassword": "CurrentPass@123"
}currentPassword is required only if the user already has a password.
Response (200 OK):
{
"message": "Password set successfully.",
"data": null,
"errorCode": null
}Errors:
400 Bad Request—currentPasswordmissing when user already has password401 Unauthorized— Invalid JWT or incorrectcurrentPassword429 Too Many Requests— Rate limit exceeded
5. hasPassword Field
All profile responses from:
GET /api/auth/meGET /api/mobile/auth/me
include hasPassword: boolean.
hasPassword: falsemeans no EMAIL provider password exists yet.hasPassword: truemeans EMAIL provider password is set.
Frontend integration:
hasPassword === false→ show "Add Password"hasPassword === true→ show "Change Password"
Data Transfer API Reference
Complete API contracts for Data Transfer, including routes, auth, DTOs, responses, errors, examples, and integration notes.
Auth Module Backend Documentation
Internal auth architecture with split admin/customer controllers for login, sessions, password reset, and verification.