UPDATE: It\'s worth mentioning, my website is being loaded via an iframe.
Here\'s my cookieSession in my app.js:
app.use(cookieParser());
app.use(
If you page is loaded in an iframe, the end user may choose to block Third Party Cookies which would prevent your website from writing the cookie.
See Safari Privacy Settings. for more info
Did you try to see if the cookie worked when the page was visited directly instead of an iframe?
It looks like you hit a Safari bug here (https://bugs.webkit.org/show_bug.cgi?id=3512);
You are redirecting any visiting browser to /dashboard while setting the cookie at the same time, and Safari is ignoring the Set-Cookie header when encountering the 302( or 301 I thing so) HTTP status.
In this case you need keep user token
in a variable an put it to /dashboard
controller then recheck and store user token
in req.session
.
login
controller) to dashboard
controllerapp.post('/login', function(req, res) {
Parse.User.logIn(req.body.username, req.body.password).then(function(user) {
res.redirect('/dashboard?token=' + user.getSessionToken() + '&user=' + user);
}, function(error) {
console.log(error)
req.session = null;
res.render('login');
});
});
app.post('/dashboard', function(req, res) {
if (req.query.user && req.query.token) {
// save for first time
req.session.user = req.query.user;
req.session.token = req.query.user;
}
// check token in session before go
});