user-login.yaml 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. post:
  2. summary: Log in
  3. operationId: loginUser
  4. tags:
  5. - Users
  6. requestBody:
  7. required: true
  8. content:
  9. application/json:
  10. schema:
  11. type: object
  12. required:
  13. - email
  14. - password
  15. properties:
  16. email:
  17. type: string
  18. format: email
  19. example: lee@example.com
  20. password:
  21. type: string
  22. example: supersecret123
  23. responses:
  24. '200':
  25. description: >
  26. Login successful. Sets an HttpOnly `token` cookie containing a signed
  27. JWT (HS256) with the user's `id` and `uuid_key`, expiring in 7 days.
  28. headers:
  29. Set-Cookie:
  30. description: HttpOnly auth cookie.
  31. schema:
  32. type: string
  33. example: token=<jwt>; Path=/; HttpOnly; SameSite=Strict
  34. content:
  35. application/json:
  36. schema:
  37. $ref: '../components/schemas/SuccessResponse.yaml'
  38. '401':
  39. description: Invalid credentials.
  40. content:
  41. application/json:
  42. schema:
  43. $ref: '../components/schemas/ErrorResponse.yaml'
  44. example:
  45. error: Invalid email or password
  46. '500':
  47. description: Internal server error.
  48. content:
  49. application/json:
  50. schema:
  51. $ref: '../components/schemas/ErrorResponse.yaml'