UNLV-CS472-672 / 2024-S-GROUP5-Munch

The Munch app is a social platform where users create profiles by selecting preferred foods.
1 stars 11 forks source link

Authorize routes #44

Closed rparker2003 closed 5 months ago

rparker2003 commented 5 months ago

Closes #15

Description / Changes Made

How to Test

  1. Create a valid JWT token by logging into the app after starting the frontend server.
  2. Start the backend server by running python server.py
  3. Navigate to Postman and give it any route, for example: http://localhost:5000/api/posts/Kr40Rksk4XI4qauBkpYb with PUT
  4. In the 'Headers' tab, add the Authorization key and include your JWT token created in Step 1
  5. Click send, and given that your decoded JWT token ["uid"] doesn't have access to that post, meaning that user_id did not create the post at that post_id, you will receive a "Unauthorized access" message along with a 403 Forbidden error code. In the above, my user_id was 'user_2cwMgsX7SwXnnnYJ2piefltKxLO' and I only have access to post 'Kr40Rksk4XI4qauBkpYb'. Trying to update the post '1Pz2MQzjlJ9yW5BuWcbc' I received an "Unauthorized access" message as expected!

Checklist