What I'm trying to do is to test the authentication functionality in Node js. I'm posting the relevant sections of code below:
...
...
var passport = require('passport'),
LocalStrategy = require('passport-local').Strategy;
...
...
passport.use(new LocalStrategy(function(done) {
return done(null, {"username": "Kevin", "password": "Pass"});
}));
...
...
app.get('/login', passport.authenticate('local', {
successRedirect: '/success',
failureRedirect: '/failure'
}));
...
...
I've not done any database check yet. Just trying to understand how it works.
Using the above code in my app.js
file always redirects to /failure
. What am I doing wrong here?
Update :
I am using the following versions:
node - 0.10.30
express - 4.8.5
passport - 0.2.0
passport-local - 1.0.0
Thanks.