How can I unstate(delete) and state(create) a cookie in single request in hapijs?

Viewed 445

I just want to do two operations in a single request. 1) Delete an older cookie for the entire domain and not just for a given path 2) Create a new cookie for the entire domain, subdomain and ports. For deleting a cookie,I tried "unstate" but the cookie does not get removed from the browser.

  "cookieOptions": {
    "ttl": 315569260000,
    "isSecure": true,
    "isHttpOnly": true,
    "isSameSite":false,
    "path":"/",
    "encoding": "base64json",
    "clearInvalid": false, // remove invalid cookies
    "strictHeader": true // don't allow violations of RFC 6265
}

sample of cookies options from my config

handler: function (request, reply) {
reply('ok').unstate(“olderCookies”).state(“newCookies”,Config.get('cookieOptions'));
}
0 Answers
Related