Can't access cookies from [removed] in JS, but browser shows cookies exist

后端 未结 6 767
时光取名叫无心
时光取名叫无心 2020-11-28 04:38

I can\'t access any cookie from JavaScript. I need to read some value and send them via JSON for my custom checks.

I\'ve tried to access cookies from JS, like it was

6条回答
  •  抹茶落季
    2020-11-28 05:16

    I would say http only is your first culprit but this can also occur by not setting the scope of your cookie.

    If the site has been redirected from another domain, you will need to look into setting the scope of the cookie. Domain and Path defines the scope of the cookie, which URLs the cookie should be sent to. Depending on this, you might not see the cookie in your response.

    I ran across this issue when setting a cookie on a successful SAML SSO login and couldn't retrieve the cookie from the Document because it was never send as part of the request.

提交回复
热议问题