Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return stackTokenCalls(req, ip).spread((user, token) => {
let options = Object.assign(
{},
{
maxAge: conf.maxAge,
path: conf.path
},
conf.domain && {
domain: conf.domain
},
conf.secure && {
secure: conf.secure
},
conf.httpOnly && {
httpOnly: conf.httpOnly
}
)
if (token) {
res.cookie(`${conf.name}_token`, token, options)
}
req.user = user.data
req.token = token
return next()
})
return stackTokenCalls(req, ip).spread((user, token) => {
let options = Object.assign(
{},
{
maxAge: conf.maxAge,
path: conf.path
},
conf.domain && {
domain: conf.domain
},
conf.secure && {
secure: conf.secure
},
conf.httpOnly && {
httpOnly: conf.httpOnly
}
)
if (token) {
res.cookie(`${conf.name}_token`, token, options)
}
req.user = user.data
req.token = token
return next()