Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can i get httpOnly cookie work with vue-resource?

work on a full spa with vue, vue-router, vue-resource, etc. sending request with vue-resource and server will return a response with a set-cookie header, but it is a httpOnly cookie, how could I make this cookie also work with the vue-resource request?

like image 211
funkyLover Avatar asked Nov 15 '16 08:11

funkyLover


1 Answers

To prevent cross-site scripting (XSS) attacks, HTTP-only cookies aren't accessible via JavaScript through the Document.cookie property, the XMLHttpRequest and Request APIs.

You may refer to here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#Secure_and_HttpOnly_cookies

like image 52
Tony Yip Avatar answered Nov 06 '22 19:11

Tony Yip