SDN302_-_PE_-_SU_2025_-_Block_1_3971.webp
lanhong87

SDN302_-_PE_-_SU_2025_-_Block_1_3971.webp

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
Chưa có bình luận nào.

Thông tin

Category
SDN302
Thêm bởi
lanhong87
Ngày thêm
Lượt xem
1,504
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom