JULIERAJ / KIDS-FIRST-Back

KIDS FIRST 2024 MVP Backend
0 stars 1 forks source link

feat/8/Add checkAuth API endpoint to protect routes #33

Closed S-chahine closed 2 months ago

S-chahine commented 2 months ago

PR Template Backend

One Line Description

Description

Notes

Test Steps

  1. Start the backend server.

  2. First try to access a protected route before being authenticated:

    • Endpoint: /api/logout Method: GET Headers: None Expected Response: 401 Unauthorized with message "No token provided"
  3. Then login to get authentication

    • Endpoint: /api/login Method: POST Headers: Content-Type: application/json Body: { "email": "user@example.com", "password": "password123" } Expected Response: 200 OK with user data and authentication token
  4. Then try the same protected route after being authenticated

    • Endpoint: /api/logout Method: GET Headers: None Expected Response: 200 OK with protected data

API Changes (if there are any) Added checkAuth to verify user authentication status.

Checklist