Server Auth
JSON Authentication with Passport and Basic HTTP
Setup
The first Step is to create a node server with a JSON api
package.json
{
  "name" : "auth-json-api",
  "description" : "auth json api",
  "version" : "0.0.1",
  "dependencies" : {
    "express" : "^4.x",
    "passport" : "^0.2",
    "passport-http" : "^0.2"
    "mongoose" : "^3.8",
    "bcrypt" : "latest",
    "jwt-simple" : "^0.2",
    "moment" : "^2.7"
  }
}$ npm install dependencies from the root folder.
Generate a self-signed ssl certificate and key and put them in a folder named config.
server.js
models/user.js
lib/authentication/passportBasic.js
routes/userRoutes.js
lib/authentication/jwtAuth.js
Last updated
Was this helpful?