You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need a way to get the user's information, particularly their role (admin or user) from the server.
Add a route and database functions to implement the following route:
GET /api/v1/currentuser
It should return something like the following:
{
"id": "12345",
"role": "administrator"
}
To get this information, you'll have to protect the route using express-jwt. This will place a user id (which it gets from the access token) on req.user.sub ('sub' is short for subject, in other words the user).
Ask for help from @richchurcher early on this one! Don't forget to write a test or two 😎 .
The text was updated successfully, but these errors were encountered:
We need a way to get the user's information, particularly their role (admin or user) from the server.
It should return something like the following:
express-jwt
. This will place a user id (which it gets from the access token) onreq.user.sub
('sub' is short for subject, in other words the user).Ask for help from @richchurcher early on this one! Don't forget to write a test or two 😎 .
The text was updated successfully, but these errors were encountered: