Skip to content

MEAN application stack with JWT driven, token-based authentication

Notifications You must be signed in to change notification settings

dmellstrom/MEAN-Seed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MEAN Stack with Token-based Authentication

Prerequisites: node/npm and MongoDB installed on host system

Installation: npm install

Run application: bin/www (serves to localhost:3000)

Authentication Flow

MongoDB stores user data, hashed passwords, and salts (mongoose.js is used for modeling)

Express API defines the REST interface (passport.js is the authentication middleware)

Angular application sends a login request to the API

Node generates a JWT with jsonwebtoken

Express sets the token as an HTTP-only cookie and sends its claim (payload) to Angular

Angular stores the claim in LocalStorage to keep track of the user’s session

The cookie is then validated by express-jwt when calling a protected API route

About

MEAN application stack with JWT driven, token-based authentication

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published