passport.js: remember me doesn't work in express app
<p>I have implemented passport-local strategy in my application. Now I'm going to implement remember me functionality:</p>

<pre><code>app.use(passport.initialize());
app.use(passport.session());

app.post("/login", function (req, res, next) {
    var authFunction = passport.authenticate("local", function (err, user, info) {
        if (err) {
            next(err);
        } else {
            req.logIn(user, function (err) {
                if (err) {
                    next(err);
                } else {
                    if (req.body.remember) {
                        req.session.cookie.originalMaxAge = 2592000000;
                    } else {
                        req.session.cookie._expires = false;
                    }
                    res.redirect("/");
                }
            });
        }
    });
    authFunction(req, res, next);
});
</code></pre>

<p>As you can see I set the <code>originalMaxAge</code>, but it doesn't work when I close and open the browser again.<br>
Any idea?</p>