Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/luisllatas-dev/Proyecto_Pasteleria_DonMamino/llms.txt

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

The Don Mamino API uses JWT-based authentication. Send your credentials to the login endpoint and receive a signed token that grants access to all protected routes. The token encodes the user’s ID, role, and assigned sede (location), and is valid for 8 hours from the time of issue.

POST /api/auth/login

Authenticate a user and receive a JWT token. No authorization header is required to call this endpoint.

Request body

email
string
required
The registered email address of the user account.
contraseña
string
required
The account password. Passwords are verified against bcrypt hashes stored in the database.

Response fields

mensaje
string
A human-readable confirmation message. Returns "Inicio de sesión exitoso" on success.
token
string
Signed JWT token. Pass this as a Bearer token in the Authorization header of protected requests. Expires after 8 hours.
usuario
object
Object containing basic information about the authenticated user.

Examples

curl --request POST \
  --url http://localhost:3000/api/auth/login \
  --header 'Content-Type: application/json' \
  --data '{
    "email": "[email protected]",
    "contraseña": "supersecreta123"
  }'

Sample response

{
  "mensaje": "Inicio de sesión exitoso",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZF91c3VhcmlvIjoxLCJyb2wiOiJhZG1pbmlzdHJhZG9yIiwiaWRfc2VkZSI6MSwiaWF0IjoxNzE2MDAwMDAwLCJleHAiOjE3MTYwMjg4MDB9.abc123",
  "usuario": {
    "id": 1,
    "nombre": "Luis Llatas",
    "email": "[email protected]",
    "rol": "administrador"
  }
}
The token expires 8 hours after it is issued. Once expired, the client must authenticate again to receive a new token.

Using the token

Include the token in the Authorization header of every protected request:
Authorization: Bearer <your_token_here>

Error responses

StatusDescription
401Invalid credentials — the email was not found or the password did not match. Response body: { "message": "Credenciales inválidas" }
500Internal server error. Response body: { "error": "<error message>" }

Build docs developers (and LLMs) love