Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to delete cookie, server-side

I am working with Node.js and want to delete all cookies for the browser, for my domain. What would be the best way to do this? Just set them to expire, or is there another trick?

like image 288
chapinkapa Avatar asked Dec 20 '22 06:12

chapinkapa


1 Answers

This is quite late, but there is a clearCookie() method on the Express response object. No need to use tricks, or artificially expire the cookie. Documentation here: https://expressjs.com/en/4x/api.html#res.clearCookie

like image 163
warriorpostman Avatar answered Dec 26 '22 02:12

warriorpostman