express 3.0 and passport authentication
===

I'm using express@3.0.0beta4 with passport@0.1.12 and using local srategy for authentication.

Everything seems to work fine and it redirects on success and failure correctly

    app.post('/login', function(req, res, next) {
      passport.authenticate('local', function(err, user) {
        if (err) {
          console.log('error: '+err);
          return next(err);
        }
        if (!user) {
          return res.redirect('/');
        }
        return res.redirect('/users/' + user.id);
      })(req, res, next);
    });

But if I add ensureAuthenticated on profile route

    app.get('/profile', ensureAuthenticated, routes.profile);

    function ensureAuthenticated(req, res, next) {
      if (req.isAuthenticated()) { return next(); }
      res.redirect('/');
    }

it redirects me back to '/' instead of '/profile' after login. The problem is req.isAuthenticated() always return false and there is no req.user variable in debug.

Is it problem with express 3 and passport interaction or I did something wrong?