Skip to main content
The authentication service (auth-service) handles user registration and login. Registration returns a plain-text confirmation. Login returns a raw JWT string — not a JSON object — which you pass as a Bearer token in the Authorization header on every subsequent request. No authentication is required to call these two endpoints.

POST /api/auth/register

Register a new user account. The password is stored as a BCrypt hash and is never returned in any response. If the email address is already in use, the request fails with a 400 error.

Request body

email
string
required
The user’s email address. Must be unique across all accounts.
password
string
required
Plain-text password. Stored as a BCrypt hash; minimum length is enforced by the client.

Response

Returns a plain-text confirmation string on success, not a JWT token.
(response body)
string
required
"Usuario registrado exitosamente" — a fixed confirmation message. To obtain a token, log in with POST /api/auth/login.

Status codes

CodeMeaning
200Registration successful. Response body is "Usuario registrado exitosamente".
400Email already registered ("Email ya registrado").

Example

curl --request POST \
  --url http://localhost:8080/api/auth/register \
  --header 'Content-Type: application/json' \
  --data '{
    "email": "ana.garcia@smartlogix.io",
    "password": "s3cur3P@ss!"
  }'
Example response (200)
Usuario registrado exitosamente

POST /api/auth/login

Authenticate an existing user. Returns a fresh JWT token on success. Returns 401 if the email is not found or the password does not match.

Request body

email
string
required
The user’s registered email address.
password
string
required
The user’s plain-text password. Compared against the stored BCrypt hash.

Response

(response body)
string
required
Signed JWT token. Use as Authorization: Bearer <token> on all subsequent requests.

Status codes

CodeMeaning
200Login successful. Response body contains the JWT token.
401Invalid credentials—email not found or password mismatch.

Example

curl --request POST \
  --url http://localhost:8080/api/auth/login \
  --header 'Content-Type: application/json' \
  --data '{
    "email": "ana.garcia@smartlogix.io",
    "password": "s3cur3P@ss!"
  }'
Example response (200)
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhbmEuZ2FyY2lhQHNtYXJ0bG9naXguaW8iLCJyb2xlIjoiUk9MRV9VU0VSIiwiaWF0IjoxNzAwMDAwMDAwfQ.SIGNATURE