Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/scoria02/marbes2021_backend/llms.txt

Use this file to discover all available pages before exploring further.

The login endpoint verifies the provided credentials against the database and, if valid, returns a signed JSON Web Token (JWT) alongside the user’s profile and their associated role permissions. You must include this token as a Bearer token in the Authorization header of every subsequent authenticated request.

Request

Method: POST
Path: /api/auth/login
Authentication: None required
Content-Type: application/json

Body parameters

email
string
The user’s email address. One of email, name, or code is required.
name
string
The user’s username. One of email, name, or code is required.
code
string
An alternative login code identifier. One of email, name, or code is required.
password
string
required
The user’s plaintext password. Compared against the stored bcrypt hash.
Exactly one identifier field (email, name, or code) must be present in the request body alongside password. Omitting all three returns a 400 validation error.

Response

200 — success

success
boolean
required
Always true on a successful response.
data
object
required

Examples

curl --request POST \
  --url http://localhost:7780/api/auth/login \
  --header 'Content-Type: application/json' \
  --data '{
    "email": "[email protected]",
    "password": "s3cur3P@ss"
  }'

Success response

200
{
  "success": true,
  "data": {
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "user": {
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "nombre": "María",
      "apellido": "González",
      "email": "[email protected]",
      "cedula_rif": "V-12345678",
      "telefono": "+58 412 555 0100",
      "cargo": "Analista",
      "departamento": "Tecnología",
      "estatus": "activo",
      "last_activity": "2024-06-01T10:30:00.000Z",
      "created_at": "2023-01-15T08:00:00.000Z",
      "updated_at": "2024-05-20T14:22:00.000Z"
    },
    "permisos": [
      {
        "rol": "editor",
        "permisos": ["read:reports", "write:reports"]
      }
    ]
  }
}

Error responses

401
{
  "message": "Credenciales inválidas."
}
400
{
  "errors": [
    {
      "message": "Se requiere al menos un identificador: email, username o code"
    },
    {
      "field": "password",
      "message": "La contraseña es requerida"
    }
  ]
}
500
{
  "message": "Error interno del servidor."
}

Build docs developers (and LLMs) love