wncc / Hello-FOSS-SOC-Portal

This is the official repository of SOC Portal by TTY-17 WnCC, IITB
3 stars 15 forks source link

Unauthorized error (401) when trying to access wishlist API #6

Open coldicedcoffee opened 1 month ago

coldicedcoffee commented 1 month ago

Whenever a request is made to /api/projects/wishlist/, a 401 Unauthorized error is returned. This seems to be caused by the authentication token not being properly sent or recognized by the backend.

Steps to Reproduce: Screenshot 2024-10-17 134322

Navigate to the Wishlist page on the frontend. The frontend attempts to send a GET request to /api/projects/wishlist/. The backend responds with a 401 Unauthorized error.

Expected Behavior: The request should send the JWT token stored in cookies, authenticate the user, and return the appropriate response (wishlist data).

Actual Behavior: The request fails with a 401 Unauthorized error. It seems that the JWT token is either missing from the request or not being processed correctly on the backend.

Additional Context: The frontend uses Axios to make the request with withCredentials enabled, but the token might not be sent due to the cookie being HttpOnly (just a guess) . CORS and credentials settings have been configured on the backend.