Skip to content

Commit

Permalink
Updated deprecated API endpoint from /users/self to /users?profile=tr…
Browse files Browse the repository at this point in the history
…ue (#27)
  • Loading branch information
Hariom01010 authored Dec 29, 2024
1 parent 702b7eb commit 0681b26
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions docs/Postman Collection/API_CALLS.json
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@
}
},
"url": {
"raw": "{{BASE_URL}}/users/self",
"raw": "{{BASE_URL}}/users?profile=true",
"host": [
"{{BASE_URL}}"
],
Expand Down Expand Up @@ -1124,7 +1124,7 @@
"method": "GET",
"header": [],
"url": {
"raw": "{{BASE_URL}}/users/self",
"raw": "{{BASE_URL}}/users?profile=true",
"host": [
"{{BASE_URL}}"
],
Expand Down
8 changes: 4 additions & 4 deletions docs/local-backend-roles/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ Please make sure that you have setup the backend locally by running the command

1. Make sure that your backend server is running. To run the server run `yarn dev` in your project directory. This will run your server on localhost:3000

2. The RDS backend hits `/users/self` endpoint to get the data of the user.
2. The RDS backend hits `/users?profile=true` endpoint to get the data of the user.

3. So let's try to access our details by going to http://localhost:3000/users/self. This will give a 401 error, to solve this follow the step below.
3. So let's try to access our details by going to http://localhost:3000/users?profile=true. This will give a 401 error, to solve this follow the step below.

4. Copy this URL `https://github.com/login/oauth/authorize?client_id=<your-client-id>` and paste it somewhere, now go to your `local.js` (you can see how we got that clientId <a href='https://www.youtube.com/watch?v=haqPaPRrhPU'>here</a>) file and copy the clientId that is present there, and paste it in place of `<your-client-id>` in the URL provided above.

5. This will redirect you to `http://localhost:3000/healthcheck`, if you go to your firebase console, you will notice that a `doc` has been created with your userId in the `users` collection in your firebase, now try going to http://localhost:3000/users/self. you can see those details.
5. This will redirect you to `http://localhost:3000/healthcheck`, if you go to your firebase console, you will notice that a `doc` has been created with your userId in the `users` collection in your firebase, now try going to http://localhost:3000/users?profile=true. you can see those details.

6. You can see that there are no roles property present in the object that is returned. we will update the doc that contains our details with the roles. Click on add fields and set the properties as shown below:

![Firebase Image](/public/assets/firebase-image.jpg)

7. Now click on add, and now if you go to http://localhost:3000/users/self, you will be able to see the roles.
7. Now click on add, and now if you go to http://localhost:3000/users?profile=true, you will be able to see the roles.

8. Now you will be able to perform actions which require admin or super_user roles in your local backend.

0 comments on commit 0681b26

Please sign in to comment.