How do HttpOnly cookies work with AJAX requests?

后端 未结 9 1173
别那么骄傲
别那么骄傲 2020-11-30 16:31

JavaScript needs access to cookies if AJAX is used on a site with access restrictions based on cookies. Will HttpOnly cookies work on an AJAX site?

Edit: M

9条回答
  •  离开以前
    2020-11-30 16:48

    No, the page that the AJAX call requests has access to cookies too & that's what checks whether you're logged in.

    You can do other authentication with the Javascript, but I wouldn't trust it, I always prefer putting any sort of authentication checking in the back-end.

提交回复
热议问题