Skip to content

chernov-anton/passport-jwt-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 

Repository files navigation

Passport jwt example

Backend

Simple express app with mocked data access layer.

Auth routes:

Login

url: POST /auth/login

body: {email, password}

Register

url: POST /auth/register

body: {email, password}

Login with google

url: POST /auth/google

body: {access_token} - actually it should be id token from google response, but passport-token-google strategy require it in this format.

User routes:

Get user info

url: GET /users/:id

Require Authoriztion: Bearer <token> header. For now it allows to request only current user. Can be extended to allow requests for other users based on rights/scopes.

Frontend

React app build with hooks and context. Several simple routes. Login form, registration form and home page. App saves token in local storage.

Points to extends

  • Add roles/rights(e.g. admin, user)
  • Add some additional fields during registration
  • Verify email during registration

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published