Ferromax ERP uses JWT Bearer tokens for authentication. Obtain a token by posting credentials toDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/DragonesMagicos/ferromax_v0.8/llms.txt
Use this file to discover all available pages before exploring further.
/auth/login, then include it in the Authorization header of every subsequent request. Tokens are signed with HMAC-SHA and carry the user’s email, role, and internal ID as claims.
POST /auth/login
Authenticates a registered, active user and returns a signed JWT access token along with the user’s role and display name. Auth: None requiredRequest body
The registered email address of the user. Must be a valid email format.
The account password in plaintext. Compared against the BCrypt hash stored in the database.
Example request
Response 200 — Success
Signed JWT access token. Include this value as
Bearer <token> in the Authorization header of all subsequent requests. Valid for 8 hours (28 800 000 ms) by default.The user’s assigned role. One of
ADMIN, EMPLEADO, or CLIENTE.The user’s first name, suitable for display in the UI.
Human-readable success confirmation. Always
"Login exitoso" on HTTP 200.Response 401 — Invalid credentials
Returned when the email is not found, the account is inactive (activo = false), or the password does not match.
POST /auth/register
Registers a new customer account. All self-registered users are automatically assigned theCLIENTE role — staff accounts with ADMIN or EMPLEADO roles must be provisioned directly in the database.
Auth: None required
Request body
The user’s first name. Maximum 100 characters.
The user’s last name. Maximum 100 characters. Optional.
Email address for the new account. Must be a valid email format, maximum 150 characters, and unique across all users.
Plaintext password. Minimum 6 characters. Stored as a BCrypt hash — never logged or returned.
Example request
Response 201 — Created
Response 400 — Email already registered
Returned when the submitted email already exists in theusuarios table.
After registering, the user must call
POST /auth/login to obtain a token. The register endpoint does not return a JWT.GET /auth/me
Returns the full profile of the currently authenticated user by extracting the email claim from the submitted JWT, then fetching the latest data from the database. Auth: Bearer token requiredRequest
No request body. The token is read from theAuthorization header.
Example request
Response 200 — User profile
The user’s internal numeric ID in the database.
The user’s first name.
The user’s last name.
The user’s email address.
The user’s current role:
ADMIN, EMPLEADO, or CLIENTE.Response 401 — Missing or invalid token
Using Tokens in Requests
After a successful login the frontend stores the token and attaches it automatically to every outgoing request via an Axios interceptor defined inaxiosClient.js. The same pattern applies to any HTTP client you use outside the frontend.
Call POST /auth/login
Post the user’s email and password. On success, save the returned
token string.Store the token
The React frontend persists the token in
localStorage (key: token) via authService.js and exposes the authenticated user via AuthContext.jsx. Note that axiosClient.js reads the token from a separate localStorage key (ferromax_token) — these two keys co-exist independently in the frontend.Attach the header
Include
Authorization: Bearer <token> in every request to a protected endpoint. The Axios client does this automatically via a request interceptor.Axios client interceptor (axiosClient.js)
The following is the actual interceptor code from the Ferromax frontend. It reads the token fromlocalStorage on every request and injects the Authorization header, and redirects to /login on any 401 response:
Tokens expire after 8 hours (28 800 000 ms), as set by
jwt.expiration in application.properties. There is no refresh endpoint — the user must call POST /auth/login again to obtain a new token after expiry.JWT token claims
Every issued token contains the following custom claims in addition to standard JWT fields:| Claim | Type | Description |
|---|---|---|
sub | String | The user’s email address (subject) |
rol | String | The user’s role (ADMIN, EMPLEADO, CLIENTE) |
usuarioId | Long | The user’s internal database ID |
iat | Date | Token issued-at timestamp |
exp | Date | Token expiration timestamp |
GET /auth/me while the token is still valid.