I have a function to login
app.post(\'/doLogin\', function(req,res){
db.users.findOne({username: req.body.username}, function(err, user) {
if
All answers so far are helpful but don't directly solve the issue with using secure:true.
In order to use secure:true you must have support for https for secure cookies. Additionally you must use withCredentials for cross-site access control. withCrendentials:true has no impact on same-site request.
https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials
Majority of libraries support this parameter in their configurations such as angular and dropzone.