Skip to navigation

check-active-driver-session

View as Markdown

Verifies if the current driver’s access token and session are active and valid. Specifically used as a heartbeat check to detect if the session was invalidated because the driver logged in on another device (Single-Device Login Enforcement).


Endpoint Overview

  • Method: GET

  • Route: /api/v1/driver/auth/session/check

  • Authentication: Bearer Token (Driver JWT)

  • Content-Type: N/A


Request Headers

HeaderTypeRequiredDescription
AuthorizationstringYesFormat: Bearer

Request Body Schema

None (GET request)


Response Body Schema (200 OK)

FieldData TypeDescription
statusstringCurrent session state ("active")
driverIdstringUnique driver ID (prefixed with drv_)
sessionVersionintegerActive session counter version in the database

Response Examples

1. 200 OK — Session Active

{
"status": "active",
"driverId": "drv_8a7b6c5d4e",
"sessionVersion": 2
}

2. 401 Unauthorized — Session Revoked (Logged In on Another Device)

Enforced via single-device policy. When this error is returned, the mobile app should immediately log out the driver and redirect to the login screen:

{
"error": "SESSION_REVOKED",
"message": "Your session has been terminated because your driver account logged in on another device."
}

3. 401 Unauthorized — Token Expired or Invalid

{
"error": "Unauthorized",
"message": "Invalid or expired driver access token."
}

4. 401 Unauthorized — Missing Token

{
"error": "Unauthorized",
"message": "Driver access token is missing. Header format must be &#x27;Bearer <token>&#x27;."
}

5. 403 Forbidden — Account Blocked / Deactivated

{
"error": "Forbidden",
"message": "Driver account is blocked or deactivated."
}

Status Codes Reference

HTTP Status CodeCondition
200 OKSession is valid, active, and belongs to the currently authenticated device.
401 UnauthorizedToken is missing, expired, or was revoked because another device signed in (SESSION_REVOKED).
403 ForbiddenDriver account has been blocked or deactivated.

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.