Skip to main content
POST
/
auth
/
login
curl -X POST http://localhost:8080/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "password": "Admin1234"
  }'
{
  "id": 1,
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbi11c2VyIiwicm9sZSI6IlJPTEVfQURNSU4iLCJpYXQiOjE3MDk0NzIwMDAsImV4cCI6MTcwOTQ3NTYwMH0.abc123def456",
  "username": "admin-user",
  "email": "[email protected]"
}

Request Body

email
string
required
Email address of the user account
password
string
required
Password for the user account

Response

id
long
Unique identifier of the authenticated user
token
string
JWT authentication token to be used for subsequent authenticated requests
username
string
Username of the authenticated user
email
string
Email address of the authenticated user
curl -X POST http://localhost:8080/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "password": "Admin1234"
  }'
{
  "id": 1,
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbi11c2VyIiwicm9sZSI6IlJPTEVfQURNSU4iLCJpYXQiOjE3MDk0NzIwMDAsImV4cCI6MTcwOTQ3NTYwMH0.abc123def456",
  "username": "admin-user",
  "email": "[email protected]"
}

Error Responses

Authentication Failed (400 Bad Request)

Returned when the email or password is incorrect:
{
  "timestamp": "2026-03-03T10:30:00.000+00:00",
  "status": 400,
  "error": "Bad Request",
  "message": "Email o ContraseƱa incorrecto",
  "path": "/auth/login"
}
This error occurs when:
  • The email address is not found in the system
  • The password does not match the stored password for the given email

Using the JWT Token

After successful authentication, include the returned JWT token in the Authorization header for subsequent requests:
curl -X GET http://localhost:8080/api/protected-endpoint \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Build docs developers (and LLMs) love