JSON Web Token (JWT) based authentication
A MEAN stack application demonstrating token based authentication without using any packages such as Passport.js. JWT as defined on JWT.io is an open industry standard method for transfering information securely between two parties.
- Node.js
- MongoDB
- Angular-cli
Clone the repo and install dependencies:
git clone https://github.com/midhun-pk/authentication-system.git
cd authentication-system
npm install
cd client
npm install
cd ..
Start mongodb and run below commands:
npm run build
npm start
Make necessary changes to config.js in authentication-system/config/config.js.
To activate email verification when signing up, make changes to mailerAuthOptions property in config.js. Follow this article to get the clientId, clientSecret, refreshToken to set up OAuth2 which is a secure way of allowing the application to use gmail service.
For frontend development:
cd authentication-system/client
ng serve
The above command starts a server at localhost:4200
To build the frontend:
cd authentication-system
npm run build
Folder client/dist will be created.
- Secure Email verification using OAuth 2.0
- Secure information ranser between client and server using JSON Web Tokens
If you'd like to contribute, please fork the repository and use a feature branch. Pull requests are warmly welcome.
The code in this project is licensed under MIT license.