Auth APIs/Setup & Login
Login
POST
/auth/loginAuthenticate a user of any role. Returns JWT + refresh token.
No authentication required
Content-Type:
application/jsonRequest Body
| Name | Type | Required | Description |
|---|---|---|---|
identifier | string | Required | Email or username |
password | string | Required | Account password |
Request Example
JSON
{
"identifier": "admin@openvts.io",
"password": "SecureP@ss123"
}Response Example
200 OK
{
"action": true,
"message": "Login successful",
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh_token": "dGhpcyBpcyBhIHJlZnJlc2ggdG9rZW4...",
"user": {
"id": "123",
"role": "ADMIN",
"username": "john_admin",
"email": "admin@openvts.io",
"name": "John Admin",
"profileUrl": "/uploads/users/123/avatar.jpg"
},
"settings": {
"dateFormat": "DD/MM/YYYY",
"languageCode": "en",
"direction": "LTR",
"theme": "LIGHT",
"timezone": "+05:30",
"timeFormat": "24H",
"distanceUnit": "KM",
"defaultLat": 28.6139,
"defaultLon": 77.209,
"mapZoom": 12
}
}
}Code Examples
curl -X POST 'https://<your-domain>:3001/auth/login' \
-H 'Content-Type: application/json' \
-d '{
"identifier": "admin@openvts.io",
"password": "SecureP@ss123"
}'Try It
API Playground
Sends a real request to the configured serverNotes
- Failed login returns HTTP 200 with action: false and a generic message to prevent user enumeration.