Skip to content

Authentication API

Base path: /api/auth

All API responses are wrapped in CommonResponseDTO (see Common Response Format below).

Login

Authenticates a user and sets a JWT cookie.

http
POST /api/auth/login
Content-Type: application/json

Request Body

FieldTypeRequiredDescription
emailstringUser email address
passwordstringUser password

Example

bash
curl -X POST http://localhost:8080/api/auth/login \
  -H "Content-Type: application/json" \
  -c cookies.txt \
  -d '{"email": "admin@example.com", "password": "secret"}'

Response 200 OK

json
{
  "code": "SUCCESS",
  "data": {
    "id": "a1b2c3d4-...",
    "email": "admin@example.com",
    "fullName": "Admin User",
    "roles": ["ADMIN"],
    "active": true
  },
  "timestamp": "2026-04-13T01:00:00Z"
}

The JWT is returned as an HTTP-only Set-Cookie header. Include it in subsequent requests using -b cookies.txt with curl, or let your HTTP client handle cookies automatically.


Get Current User

Returns the currently authenticated user's profile.

http
GET /api/auth/me

Example

bash
curl http://localhost:8080/api/auth/me -b cookies.txt

Response 200 OK

json
{
  "code": "SUCCESS",
  "data": {
    "id": "a1b2c3d4-...",
    "email": "admin@example.com",
    "fullName": "Admin User",
    "roles": ["ADMIN"],
    "active": true
  }
}

Change Password

Updates the authenticated user's password.

http
PUT /api/auth/me/password
Content-Type: application/json

Request Body

FieldTypeRequiredDescription
currentPasswordstringExisting password
newPasswordstringNew password

Example

bash
curl -X PUT http://localhost:8080/api/auth/me/password \
  -H "Content-Type: application/json" \
  -b cookies.txt \
  -d '{"currentPassword": "old", "newPassword": "newSecret123"}'

Response 200 OK

json
{ "code": "SUCCESS" }

Common Response Format

Every API response is wrapped in CommonResponseDTO:

json
{
  "code": "SUCCESS",
  "message": null,
  "data": { ... },
  "meta": null,
  "timestamp": "2026-04-13T01:00:00Z"
}
FieldTypeDescription
codeResponseCodeSUCCESS or an error code
messagestring?Human-readable error message (null on success)
dataT?Response payload
metaobject?Extra metadata (e.g. validation details)
timestampInstantServer-side timestamp

MetaOne Platform Documentation