/JWT-auth

Template for JWT authentication in a MERN app with protected routes

Primary LanguageJavaScript

JWT authentication template for MERN

  • Login, registration, logout, and checking user's authentication status.
  • Storing authenticated users in global context. 
  • Checking if a user is logged in based on their HTTP-only cookie/JWT token. 
  • Protecting routes for authenticated users only. 
  • Redirecting users and conditional rendering based on their authentication status.

Instruction (updated by 09/19/2022)

  • cd into react directory, run npm install
  • check the node version, the latest version is v16, we need it to be v14
  • at root directory, run npm install
  • run npm start
  • cd into react directory, run npm start
  • go to localhost:3000, should see an page

Note from Author