Authentication, Sessions, and CORS
Cookie-based security mechanisms and origin policies for the API.
Authentication and Sessions
This system does NOT use JWT. Authentication is managed entirely via session cookies (connect.sid) stored in MySQL through Sequelize.
Workflow
POST /login➔ Validates credentials using Argon2 and generates the session cookie.- The cookie stores the user’s
UUIDwithin the session store. GET /me➔ Returns current authenticated user data.DELETE /logout➔ Destroys the active session.
Cookie Configuration by Environment
| Property | Development | Production |
|---|---|---|
secure |
false |
true (requires HTTPS) |
sameSite |
lax |
none |
httpOnly |
true |
true |
maxAge |
24 hours | 24 hours |
📌 Frontend Rule: All
fetchoraxiosrequests must explicitly includecredentials: "include"/withCredentials: true.
Allowed CORS Origins
Whitelisted origins by default:
https://lerdo-front.vercel.apphttps://portal.lerdocontemporaneo.comhttp://localhost:3000andhttp://localhost:3001