How can I navigate users to the same page after an OAuth request to Twitter by setting a session variable?
Here is how the routes are currently configured:
// Authentication routes
(function () {
app.get('/auth/twitter', passport.authenticate('twitter'));
app.get('/auth/twitter/done',
passport.authenticate('twitter', {
failureRedirect : '/auth/error'
}),
function (req, res) {
res.send('Logged In.');
});
app.get('/auth/error', function (req, res) {
res.send('An error has occurred.');
});
}());
I know I can read the session variable in the route "/auth/twitter/done"
and redirect to the page it contains. But how do I properly set it?
app.get('/auth/twitter', passport.authenticate('twitter'),
function (req, res) { req.session.authReturnPage = '...'; });
However, this code does not seem to work.