I've been looking for authentication in nodeJs. I've looked at PassportJs and Everyauth. Both of them had old documentation and old version of express used. Things that depreciated in express 4+.
app.use(express.cookieParser());
app.use(express.bodyParser());
I had a look at this question, which had nice answers. But had no success implementing them on PassportJs or Everyauth. So does anyone know an method to implement this ? or can anyone give me an authentication tutorial for express 4+ nodeJs authentication ?
Should work like this:
var bodyParser = require('body-parser'),
cookieParser = require('cookie-parser'),
express = require('express'),
session = require('express-session'),
passport = require('passport');
var app = express();
app.use(cookieParser());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
app.use(session({
secret: 'secrit cat',
resave: true,
saveUninitialized: true
}));
app.use(passport.initialize());
app.use(passport.session());