CoffePrice’s session endpoints let users authenticate with their email and password, retrieve their current profile, and end their session. Authentication state is maintained via a signed JWT stored in theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/JaiderT/CoffeePrice/llms.txt
Use this file to discover all available pages before exploring further.
auth_token HttpOnly cookie that is automatically attached to every subsequent request from the browser.
POST /api/auth/login
Validate credentials and issue a session cookie.loginLimiter).
Request Body
The user’s registered email address. Case-insensitive — normalized to lowercase server-side.
The account password.
Success Response — 200 OK
On success the server:
- Sets the
auth_tokenHttpOnly cookie containing a signed JWT. - Updates the user’s
ultimaConexiontimestamp. - Returns the user session object in the response body.
Condensed session object.
Shorthand copy of
user.rol.Shorthand copy of
user.nombre.Shorthand copy of
user.apellido.Shorthand copy of
user.id.Shorthand copy of
user.celular.Shorthand copy of
user.email.Error Responses
| Status | Condition |
|---|---|
400 | Missing email or password, invalid email format, or the account was created via Google (no local password). |
401 | Email not found or password does not match (Credenciales invalidas). |
403 | Account is pendiente (unverified), rechazado (rejected), or eliminado (deleted). |
429 | Rate limit exceeded (10 attempts per 15 minutes). |
500 | Unexpected server error. |
Example
GET /api/auth/me
Return the full profile of the currently authenticated user.auth_token cookie (set automatically by the browser) or supply the token manually via the Authorization: Bearer <token> header.
Response — 200 OK
Sensitive fields are stripped before the document is returned. The following fields are excluded from the response: password, codigoVerificacion, codigoVerificacionExpira, codigoRecuperacion, codigoExpiracion.
MongoDB ObjectId of the user.
First name.
Last name.
Email address.
Account role:
productor, comprador, or admin.Account state:
activo, pendiente, suspendido, rechazado, or eliminado.Phone number, if provided.
Google account identifier, present only for OAuth-registered users.
ISO 8601 timestamp of the user’s most recent login.
ISO 8601 timestamp of account creation (added by Mongoose
timestamps).Error Responses
| Status | Condition |
|---|---|
401 | No token provided, or the token is invalid/expired. |
403 | Account state is rechazado, eliminado, or pendiente (non-comprador). |
404 | Token is valid but no matching user was found in the database. |
Example
POST /api/auth/logout
End the current session and clear all authentication cookies.auth_token cookie and the connect.sid session cookie from the browser. The Cache-Control: no-store header is set to prevent the browser from caching the response.
No request body is required.