Skip to content

Latest commit

 

History

History
52 lines (36 loc) · 1.06 KB

README.md

File metadata and controls

52 lines (36 loc) · 1.06 KB

Description

Nodejs User authentication system

Token-based Authentication

Token-Auth is a Token-based Authentication system. It generates token and stores them in local storage with user informations. It verifies provided token from HTTP Header (Authorization) in order to allow access to protected end point api.

Installation

Get the sources:

git clone https://github.com/Gulshan-gaur/User_AUTH_NODEJS.git

NodeJS

In order to start the nodejs server, we need express and node_modules dependencies.

Install the nodejs dependencies:

home$ npm install

Start the server:

home$ node index.js

Usage

Generates a token and stores it

home$ curl http://localhost:3001/signin

This send back the generated token for later usage.

Access protected endpoint

home$ curl --header 'Authorization: AUTH Generated_Token' http://localhost:3001/protected

Expire a token

home$ curl --header 'Authorization: AUTH Generated_Token' http://localhost:3001/expire

Stack

  • Node.js
  • Passport