Send a set-cookie header to a redirect url in node.js
After lots of trials and errors and googling I was finally able to achieve my goal. In order to send a cookie with an expiry to the the redirect URL, I just added
s = body.exp.toUTCString();res.cookie('id_token' ,body.id_token, {expires: s});res.redirect(302, 'http://localhost:8080');
in express 4.16.3 , you must set
res.cookie()
before
res.redirect()
and it works for me, without error