javascript - Cookie not going through -
i'm trying set cookie in express framework, isn't going through, , life of me can't figure out why. relevant code looks this:
module.exports = function(app) { return function(req, res, next) { if (req.cookies.user_token) { req.session.cookie.httponly = false res.cookie('user_token', req.cookies.user_token, { domain: 'www.example.com', httponly: false, path: '/', maxage: 900000 }); } return res.redirect('https://www.example.com/index.jsp?other_stuff=value'); } }
i can see request going out, , cookie not getting set. i've stepped through debugger, , know code getting hit.
i found question:
how set cookie in node js using express framework?
based on that, tried calling var express = require('express'); app.use(express.cookieparser());
earlier in code, didn't seem make difference.
anybody have ideas i'm going wrong here?
if redirected domain (say, www.example.com
) (as indicated in comments) different domain trying set cookie (say, www.foo.io
), cookie not honored browser.
Comments
Post a Comment