I want to change a session cookie after an asynchronous request but no matter what I tried I keep failing. My request is as follows:
$.ajax({
type: \"POST\"
You should call req.session.save() after the modifications if you are doing it with ajax.
exports.setStatus = function(req, res)
{
req.session.userId = req.body.userId;
req.session.token = req.body.token;
req.session.tokenSecret = req.body.tokenSecret;
req.session.service = req.body.service;
req.session.loggedIn = req.body.loggedIn;
req.session.authorized = req.body.authorized;
req.session.save(); // This saves the modifications
res.header('Access-Control-Allow-Credentials', 'true');
res.writeHead(200);
};