You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Lucina API is a RESTful HTTP API built with ASP.NET Core 9. All requests and responses use JSON. Authentication is handled via HttpOnly cookies set by the /api/auth/login endpoint.
The API is documented interactively via Swagger at https://localhost:5001/swagger when running locally.
Auth Levels
Label
Meaning
--
Public endpoint, no authentication required
[jwt]
Requires a valid access_token cookie
[admin]
Requires a valid access_token cookie with the Admin role claim
2. Authentication
Lucina uses a dual-token JWT strategy. On successful login, the API sets two HttpOnly cookies:
Cookie
Lifetime
Scope
access_token
15 minutes
All API requests
refresh_token
7 days
Path-scoped to /api/auth only
All authenticated requests must include withCredentials: true so the browser transmits the cookies automatically. When the access_token expires, the client should call POST /api/auth/refresh to obtain a new pair of tokens without requiring the user to log in again.
Note: Cart ownership is enforced server-side. Authenticated users can only access their own cart. Unauthenticated users are identified by a client-generated userId.
POST /{userId}/add
// Request body
{
"productId": 3,
"quantity": 2
}
// Response: 200 OK -- updated cart object// Response: 400 Bad Request (insufficient stock)
{
"message": "Only 1 unit available"
}
3.4 Payment -- /api/payment
Method
Endpoint
Auth
Description
POST
/create-order/{userId}
[jwt]
Create an order from the current cart. Verifies stock and ownership.
POST
/{orderId}/process-payment
[jwt]
Process payment for an existing order (simulated in v1.0).
GET
/{orderId}
[jwt]
Get details of a specific order.
GET
/user/{userId}
[jwt]
Get all orders for the authenticated user.
Note: All payment endpoints verify that the order belongs to the authenticated user before processing. Payment processing is simulated in v1.0 -- no real transaction takes place.