Authentication
TaskSocial uses JWT-based authentication with an HttpOnly cookie. The authentication flow is:Register a user
Create an account using:Log in
After registering, log in using:- Finds the user by email.
- Compares the submitted password with the stored bcrypt hash.
- Creates a JWT after successful verification.
- Stores the JWT in an HttpOnly
tokenNamecookie.
The authentication cookie
After a successful login, the server sends the JWT through thetokenName cookie.
The cookie is marked as HttpOnly, which means client-side JavaScript cannot directly read the authentication token.
The browser can still send the cookie with requests to the API.
The basic flow is:
Making a protected request
Once logged in, you can access protected endpoints. For example:tokenName cookie and verifies the JWT.
Authentication and task ownership
Authentication identifies the user making the request. Task ownership adds another authorization check. When a user tries to update or delete a task, the backend checks whether that task belongs to the authenticated user. This prevents one user from modifying another user’s tasks. The flow is:Log out
To log out, use:Authentication endpoints
For request schemas, responses, and interactive examples, see the API Reference.