Skip to content

A demo for user account registering and login using jsonwebtoken and passport-jwt for authentication purpose.(MVC architecture),Rest API

Notifications You must be signed in to change notification settings

purewebstar/nodejs-passport-jwt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

User Account Register and Login Using Jsonwebtoken

Simple user account registering and login app using nodejs, expressjs and mongodb using jsonwebtoken, passport and passport-jwt for authentication.

Prerequisite:

  • npm latest version
  • REST Client Extension for Visual Studio (for checking api end points)

Technologies used:

1. Backend

  • Nodejs
  • ExpressJs
  • MongoDb

2. For Api testing

  • Rest Client

Dependency install

npm install --save

Dependencies are:

express, bcrypt, cors, jsonwebtoken, passport, passport-jwt, mongoose, dotenv, cookie-parser

Dev Dependency install

npm install --save-dev

Dev Dependency is:

nodemon

Run Project

npm run devStart

Or

nodemon app.js

Rest Client Api testing

Creating User Account

POST http://localhost:4000/api/create-user
Content-Type: application/json

{
    "fullName": "Abraham Mitiku",
    "email": "abraham@gmail.com",
    "password": "123"
}

Login user account

POST http://localhost:4000/api/create-user
Content-Type: application/json

{
    "email": "abraham@gmail.com",
    "password": "123"
}

Reading authorized resources

GET http://localhost:4000/api/read-user-info
Content-Type: application/json
Authorization: Bearer

You can add authorized resource end points

About

A demo for user account registering and login using jsonwebtoken and passport-jwt for authentication purpose.(MVC architecture),Rest API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published