microcipcip / cookie-universal

Universal cookie plugin, perfect for SSR
525 stars 39 forks source link

Cannot set cookies on client when `httpOnly` is set on `true` #107

Closed kylemod closed 3 years ago

kylemod commented 3 years ago

$cookies.set('token', 'apikey') = works on client

$cookies.set('token','apikey', { httpOnly: true} ) = doesn't work in client

And it works on server like nuxtServerInit

microcipcip commented 3 years ago

Hi @kylemod, you can't set, edit or delete a cookie that has httpOnly set to true. That is a browser security limitation. A httpOnly cookie can only be set server side. Hope this answer your question.