Skip to content

Instantly share code, notes, and snippets.

@kylemac
Last active December 18, 2015 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kylemac/5845878 to your computer and use it in GitHub Desktop.
Save kylemac/5845878 to your computer and use it in GitHub Desktop.
What am I doing wrong? Whenever POST /login is hit, it just hangs...
// routes/auth.js
var passport = require('passport')
, LocalStrategy = require('passport-local').Strategy;
exports.member_auth = function(req, res) {
// console.log("Request Body == ", req.body);
var strategy = new LocalStrategy({
usernameField: 'email',
passwordField: 'password'
},
function(username, password, done) {
console.log("username: " + username);
console.log("password: " + password);
return done(null, false);
// when this route is hit, it just hangs, despite returning done(null, false)
});
passport.use(strategy, function(username, password, done){
// silence is golden
});
passport.authenticate('local');
}
// routes/index.js
var auth = require('./auth');
exports.set = function(app, express) {
app.post('/login', auth.member_auth);
// when this route is hit, it just hangs, despite returning done(null, false)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment