General Login API
Overview
General authentication endpoint for all user roles (SUPER_ADMIN, COMPANY_ADMIN, COMPANY_MANAGER, COMPANY_EMPLOYEE, USER).
- Endpoint:
/api/auth/login - Method:
POST - Access: Public / Authenticated Users
Request Body Schema
| Field | Type | Required | Description |
|---|---|---|---|
email | String | Yes | User email address |
password | String | Yes | Account password |
Request Body Example
{
"email": "vikram.singh@abbott.com",
"password": "Password123!"
}
Success Response (200 OK)
{
"success": true,
"message": "Login successful",
"data": {
"user": {
"id": "u9876543-21ba-fedc-3210-9876543210fe",
"email": "vikram.singh@abbott.com",
"firstName": "Vikram",
"lastName": "Singh",
"companyId": "c478a846-993d-4c8d-bf8d-d77cb3370e01",
"company": {
"id": "c478a846-993d-4c8d-bf8d-d77cb3370e01",
"name": "Abbott Healthcare"
},
"band": {
"id": "b123-uuid",
"name": "Band 1",
"autoApprovalLimit": "7000.00"
}
},
"roles": [
"COMPANY_EMPLOYEE"
],
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
}
Error Response (401 Unauthorized)
{
"success": false,
"message": "Invalid email or password",
"data": null
}
Database Impact
- Tables:
users,companies,departments,employee_bands,user_role_maps - Operations:
SELECTuser details, bcrypt password comparison,UPDATElastLoginAt.