title: passport authentication failed in basic example
body: <p>I am trying to break down this passport.js example to its most basic elements. I keep getting a 401 (Unauthorized) message and can't figure out why. Any help would be greatly appreciated. </p>
  
  <p>Thank you!</p>
  
  <p>Node.js file:</p>
  
  <pre><code>var http = require('http'),
  express = require('express'),
  passport = require('passport'),
  LocalStrategy = require('passport-local').Strategy,
  flash = require('connect-flash');
  
  var port = process.env.PORT || 8080;
  
  passport.serializeUser(function(user, done) {
    done(null, user);
  });
  
  passport.deserializeUser(function(obj, done) {
    done(null, obj);
  });
  
  passport.use(new LocalStrategy(
    function(username, password, done) {
     console.log("LocalStrategy working...");
     return done(null, { id: 1, username: 'Joe', password: 'schmo'});
    }
  ));
  
  var app = express();
  
  app.configure(function(){
    app.use(express.static(__dirname + '/app'));
    app.use(express.cookieParser('big secret'));
    app.use(express.bodyParser());
    app.use(express.methodOverride());
    app.use(express.cookieSession());
    app.use(flash());
    app.use(passport.initialize());
    app.use(passport.session());
    app.use(app.router);
  });
  
  app.get('/', function (req, res) {
    res.sendfile(__dirname + '/index.html');
  });
  
  app.post('/login', passport.authenticate('local'), function (req, res) {
    console.log("authenticated....");
    res.end();
  });
  
  app.listen(port);
  </code></pre>