Tuesday 6 June 2017

Overwrite / update browser cookie

I have an Express 4.x app, and I pass a cookie to the browser with

res.cookie('foo','bar1', {maxAge:99999999999});

it expires in the distant future. However, 5 minutes later, I get another request from the same user, and I want to give them a new cookie.

 res.cookie('foo','bar2', {maxAge:99999999999});

From my debugging, it looks like the new cookie doesn't overwrite the old cookie? Is that the case? How can I update/overwrite the old cookie with the new one?



via Alexander Mills

No comments:

Post a Comment