/Auth-SPA

Sample Project for JWT authentication in a Single Page App

Primary LanguageJavaScriptMIT LicenseMIT

JWT Auth App

Version License: MIT Twitter: HoukasaurusRex

Sample Project for JWT authentication in a Single Page App

This project was inspired by known issues for storing JWT tokens in an SPA, and serves as an attempt at a MEVN stack implementation of a two-cookie SPA authentication method.

Goals

  • Reduce the surface area of attack for user authentication
  • Compatibility with OAuth 2.0 and good ol' username + password
  • Username and password can be supplemented with optional 2FA
  • Users can get a different post-login user experience depending on their account type and user permissions
  • Sessions can be terminated in client or server
  • Sessions can be expired after a given amount of time

Install

yarn install

Usage

To start the dev client and server, run:

yarn start

Then navigate to localhost:8080.

Notes

  • By signing JWT tokens with a uuid-generated string generated for each user, this method remains stateful to avoid user forging.

Contributing

For information on how to contribute to this project, please refer to the contributing guidelines

Author

👤 JT Houk jt1992@gmail.com (https://jt.houk.space/)

Show your support

Give a ⭐️ if this project helped you!