Login Authentication In Nodejs
I have 2 main pages. One page is mywebsite.com/login mywebsite.com /login page shows login and password page. When the user successfully gets authenticated, the mywebsite.com pa
Solution 1:
I suggest you use the express-session npm Module to maintain sessions. https://www.npmjs.com/package/express-session
You need to include it in your app.js
var session = require('express-session');
Give it a secret key
app.use(session({secret: 'anystringhere'}));
And change this code a bit
if (!response.success) {
console.error("error is: ", response.message);
res.status(200).send(response);
return;
}
else{
req.session.loggedIn = true;
}
This should do the trick
Post a Comment for "Login Authentication In Nodejs"