Skip to content

Authentication ​

text
Authorization: Bearer <access-token>

Architecture ​

text
Access Token  (short-lived, not stored)
     +
Refresh Token (stored as a hash in user_sessions)
     +
Device Session (revocable)

Access tokens are short-lived and deliberately not persisted server-side, so a session is terminated by revoking the refresh token rather than by waiting for a token to expire. POST /auth/logout takes effect immediately.

Endpoints ​

text
POST /api/v1/auth/register
POST /api/v1/auth/login
POST /api/v1/auth/refresh
POST /api/v1/auth/logout

Register ​

json
{
  "name": "Michael Joseph",
  "mobile": "+971500000000",
  "email": "user@example.com",
  "password": "********"
}
json
{
  "user": {
    "id": "usr_01J...",
    "status": "PENDING_VERIFICATION"
  }
}

A new account is PENDING_VERIFICATION and cannot publish a journey or request a seat. Verification is a prerequisite, not an optional hardening step — an unverified participant has no value in the audit trail and cannot be held accountable for a journey.

Login ​

json
{
  "mobile": "+971500000000",
  "password": "********"
}
json
{
  "accessToken": "token",
  "refreshToken": "token",
  "expiresIn": 900
}

expiresIn is in seconds. The refresh token is returned once, stored as a hash, and rotated on every refresh so a captured refresh token has a bounded useful life.

Refresh ​

json
{ "refreshToken": "token" }

Issues a new access token. Presenting a revoked, expired or already-rotated refresh token fails with AUTH_INVALID.

Logout ​

Revokes the active session.

Security notes ​

  • Passwords are never logged and never returned.
  • Mobile numbers are unique and verified before they can be used for recovery.
  • Failed verification dependencies resolve to PENDING/REVIEW, never to VERIFIED. See Compliance Engine.
  • Session revocation is audited.
  • Identity documents are never stored in ordinary user records. See Users.

KHAWI — same route, go together.