How to set and delete cookies with Express

January 24, 2021

Setting cookies

res.cookie("token", MY_TOKEN, { maxAge: MILLISECONDS_FROM_NOW_TO_EXPIRE })

There's more options (other than maxAge) described in the Express documentation.

Deleting cookies

res.clearCookie("token")

A quick favor: was anything I wrote incorrect or misspelled, or do you still have questions? Please use this form to let me know or ask for help!