Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a route to request user details #88

Open
2 tasks
richchurcher opened this issue Dec 3, 2018 · 0 comments
Open
2 tasks

Add a route to request user details #88

richchurcher opened this issue Dec 3, 2018 · 0 comments
Assignees
Labels
server Backend feature

Comments

@richchurcher
Copy link
Contributor

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 😎 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
server Backend feature
Projects
None yet
Development

No branches or pull requests

2 participants