Authentication

NodeLoom uses JWT-based authentication delivered via httpOnly cookies. After a successful login, the server sets a secure cookie that is automatically included in all subsequent requests.

Cookie-based sessions

No manual Authorization header is required. The JWT is stored in a secure, httpOnly cookie and sent automatically by the browser. For non-browser clients, capture the Set-Cookie header and include it in subsequent requests.

Login

POST
/api/auth/login

Authenticate and receive a JWT cookie

Request Body

FieldTypeRequiredDescription
emailstringYesRegistered email address
passwordstringYesAccount password
Request
{
  "email": "jane@example.com",
  "password": "securepassword123"
}

Response

On success, the response includes the user object and a Set-Cookie header containing the JWT token in an httpOnly cookie.

200 OK
{
  "id": "uuid",
  "firstName": "Jane",
  "lastName": "Doe",
  "email": "jane@example.com",
  "teams": [
    {
      "teamId": "uuid",
      "teamName": "My Team",
      "role": "ADMIN"
    }
  ]
}

cURL example

curl -c cookies.txt -X POST https://your-nodeloom-instance.com/api/auth/login -H "Content-Type: application/json" -d '{"email":"jane@example.com","password":"securepassword123"}'

Refresh Token

POST
/api/auth/refresh

Refresh the JWT token before it expires

Call this endpoint to obtain a fresh JWT token. The existing cookie must still be valid (not expired). The server replaces the current cookie with a new one that has an extended expiry.

Response

200 OK
{
  "message": "Token refreshed successfully"
}

Token expiry

If the current token has already expired, the refresh will fail with a 401 status. The user must log in again.

Logout

POST
/api/auth/logout

Clear the JWT cookie and end the session

Clears the httpOnly JWT cookie on the server side. After calling this endpoint, the user is no longer authenticated and must log in again.

Response

200 OK
{
  "message": "Logged out successfully"
}

Error Codes

StatusMeaning
400Invalid request body or missing required fields
401Invalid credentials or expired token