MindFlow uses stateless JSON Web Tokens (JWT) to authenticate every protected API request. The flow is straightforward: callDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/J0S3-LEON/pf_pruebasAseguramientoCalid_SDD/llms.txt
Use this file to discover all available pages before exploring further.
POST /api/v1/auth/register once to create an account, then call POST /api/v1/auth/login to receive a signed token. Include that token in the Authorization header of all subsequent requests. When the token expires after 24 hours, log in again to receive a fresh one.
Obtaining a token
Send aPOST request to /api/v1/auth/login with a valid email and password. On success you receive a signed JWT in the response envelope:
Using the token
Pass the token as a Bearer credential in theAuthorization header on every protected request:
JwtAuthGuard inspects this header on every route that is not explicitly marked @Public(). If the header is absent, malformed, or carries an expired token, the API immediately returns 401 Unauthorized.
Token payload
Tokens are signed with the HS256 algorithm. Once decoded, the payload conforms to theStudentPayload interface:
studentId field is attached to every incoming request by JwtAuthGuard and is used by downstream services to enforce per-student data isolation. Requests that attempt to access another student’s resources receive 403 Forbidden.
Token expiry
Every token expires exactly 24 hours after it is issued (exp = iat + 86400). Once expired, the API returns:
POST /api/v1/auth/login again. There is no refresh-token mechanism — a fresh login always produces a new 24-hour token.
Public routes
Only two routes bypassJwtAuthGuard entirely:
| Method | Path | Reason |
|---|---|---|
| POST | /api/v1/auth/register | Creates a new account — no prior token exists |
| POST | /api/v1/auth/login | Issues the initial token — credentials are the proof of identity |
@Public(). The guard checks for this decorator before attempting any token verification, and also performs an explicit path-level check as a belt-and-suspenders safeguard. Every other route in the system goes through full JWT verification.
The
@Public() decorator sets a metadata key on the route handler. JwtAuthGuard reads that key via NestJS’s Reflector before extracting or verifying any token. If the key is present, the guard short-circuits and returns true immediately.Complete example: register → login → use token
The following three steps take a new student from zero to making authenticated API calls:Error reference
| Status | Trigger | Notes |
|---|---|---|
| 401 Unauthorized | Invalid credentials at login | Message is intentionally generic — does not reveal which field is wrong |
| 401 Unauthorized | Missing Authorization header on protected route | Include Authorization: Bearer <token> |
| 401 Unauthorized | Expired or tampered token | Re-authenticate with POST /api/v1/auth/login |
| 409 Conflict | Registering with an email already in use | Each email maps to exactly one student account |