-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to get cookie header #163
Comments
If the cookies apply to the current domain/page, then you should be able to access them via |
Cookie is not available in the document.cookie, otherwise i wouldn't create an issue here. The header "SET-COOKIE" completely ignored and not available in the response.headers. |
Does the header appear if you instrument the header parsing with |
I think this is a duplicate of #138. |
Yes, I don't think XHR is able to access |
Correct, so what should be a solution here? Send a different custom header or you know a better approach? |
Well, we don't know what your problem is, so we can't offer a solution yet. The browser doesn't want you to read |
Maybe you're running into the |
Ok, i see, the cookie is needed to authenticate the user - thats how it works by default. Server set the cookie and i send it back with each request (pretty common approach). The issue i faced with - is that cookie is not set for some reason, probably i used fetch library wrong. Thank you for your response, i'll investigate. |
@AlexKovalevych I understand. Then, you should leave it to the browser to handle all the cookie stuff. However, if the browser is not sending the authentication cookie back to the server when you're using To have fetch(url, {credentials: 'same-origin'}) |
i have meet the same problem, but finally i realize that i don't need to get the 'Set-Cookie' from headers, use credentials: 'same-origin' (or 'include'), it helps me to send my browser cookie which server sends to me back to them. whatever they send to us, like login state or other values, its totally controlled by the server. |
@mislav Thanks a lot. Was so hard to find this answer. |
Thank you very much @fanqidaoerxing. include option has done it for me. |
The server sends me a response header "SET-COOKIE" and i'm not able to retrieve it - it just doesn't appear among headers. Probably it doesn't pass a normalizer test, is this how it should work or i missed something? How can i retrieve it? Thanks in advance.
The text was updated successfully, but these errors were encountered: