NodeJS Authentication Boilerplate with Passport JWT Strategy
Open console and issue
$ git clone https://github.com/SamuelRoberto/nodejs-auth-passportjwt.gitThen in the project directory
$ npm installAnd start the project
$ npm startMIT
Authentication routes. You can use this routes to create Account or Login into the App.
| Path | Description |
|---|---|
| localhost:3000/api/v1/register | Create account into MongoDB |
| localhost:3000/api/v1/login | Generate TOKEN for Authentication |
Register JSON Stringify Example:
{ "name": "Admin", "lastname": "Admin", "email": "admin@admin.it", "password": "password" }In order to user Token you should:
- Make request to 'login' with correct account
- Save the Token that is sended by Server
- Append Token in Header of each request that need Authentication check in the "Authorization" attribute using 'Bearer' standard.
Free routes. All users can see this routes without any token.
| Path | Description |
|---|---|
| localhost:3000/free | Free route for all user |
Secret routes. You can see the content of this routes only if you have a valid token.
| Path | Description |
|---|---|
| localhost:3000/secret | Secret route for onyl authenticated user |
MIT