The login endpoint authenticates a user by forwarding credentials to the configured external auth service (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/BladimirGS/judicial-backend/llms.txt
Use this file to discover all available pages before exploring further.
EXTERNAL_AUTH_URL). On success, the backend issues a signed JWT access_token to the caller and stores a refreshToken in an HttpOnly cookie scoped to /api/auth. The cookie is never accessible to JavaScript and is used exclusively by the /refresh and /logout endpoints.
Endpoint
POST /api/auth/login
| Property | Value |
|---|---|
| Auth required | No — public endpoint |
| Rate limited | Yes — 20 requests per 15 minutes (auth limiter) |
| Content-Type | application/json |
Request Body
The username of the account to authenticate. Must be a non-empty string.
The password for the account. Must be a non-empty string. Transmitted over HTTPS only.
Response — 200 OK
A successful authentication returns a JSON body with theaccess_token and sets a refreshToken cookie. Use the access_token as a Bearer token in the Authorization header for all protected routes.
Always
"success" on a 200 response.Human-readable confirmation, e.g.
"Inicio de sesión exitoso".Set-Cookie header
Along with the JSON body, the server sets the following cookie:| Attribute | Value |
|---|---|
| Name | refreshToken |
| HttpOnly | true — inaccessible to JavaScript |
| Path | /api/auth — sent only to auth endpoints |
| Max-Age | 86 400 seconds (24 hours) |
| Secure | Enabled in production (COOKIE_SECURE=true) |
Store the cookie with your HTTP client (e.g.
-c cookies.txt in curl, a cookie jar in your SDK). It is required to call /refresh and /logout.Error Responses
| Status | Code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR | Missing or invalid fields — usuario or contrasenia failed class-validator checks |
| 401 | UNAUTHORIZED | Invalid credentials — the external auth service rejected the supplied username/password |
| 503 | SERVICE_UNAVAILABLE | External auth service is unreachable or returned an unexpected error |