Kizspy.me
Additional Requirement: Automatically update the availableTickets field of the
event (decrease based on quantity booked).
Question
Question 5 (1 point) - User Authentication with JWT
Task: Implement login functionality using JWT and protect private routes.
Login API:
• Method: POST
•
URI:
http://localhost:9999/api/users/login
Input: {"email": "...", "password": "..." }.
Data for testing: {"email": "
[email protected]", "password": "password123"}
Output: {"token": "..."}
Zoom
о If invalid email or password, returns message: "Invalid credentials"
• Note: Use JWT_SECRET from .env and token should expire in 1h.
Protected API:
• Method: GET
• URI:
http://localhost:9999/api/users/profile
Header: Authorization: Bearer <token>
+ 100%
Close