POST
/
api
/
auth
/
login
Login with username and password
curl --request POST \
  --url http://localhost:3000/api/auth/login \
  --header 'Content-Type: application/json' \
  --data '
{
  "username": "<string>",
  "password": "<string>"
}
'
{
  "success": true,
  "message": "<string>",
  "data": {
    "token": "<string>",
    "worker": {
      "_id": "<string>",
      "name": "<string>",
      "username": "<string>",
      "position": "<string>",
      "role": "<string>",
      "notificationPreferences": {
        "enabled": true,
        "volume": 0.6,
        "sounds": {
          "low": "soft_pop",
          "medium": "ding",
          "high": "alert",
          "urgent": "alert"
        }
      },
      "createdAt": "2023-11-07T05:31:56Z",
      "updatedAt": "2023-11-07T05:31:56Z"
    }
  }
}

Body

application/json
username
string
required
Minimum string length: 1
password
string
required
Minimum string length: 1

Response

Login successful. The worker object includes a populated role (full role document with permissions, not only an id).

success
boolean
Example:

true

message
string
data
object