-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
session cookie not passed on Ajax requests #89
Comments
https://developer.mozilla.org/en-US/docs/Web/API/RequestInit#credentials Please refer to the link above to correctly transmit the cookie. |
I also tried setting I also tried setting All my Javascript code does it the following:
|
According to the document at https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#including_credentials, when the SameSite attribute of your cookies is set to Strict or Lax, cookies will not be sent even if the credentials are set to include. Please check the SameSite attribute of your website's cookies. |
Thank you for your additional insight. It should be noted that the session cookie is from the same domain, so from my understanding this should not be an issue. |
So in my api.php I have. These are the endpoints I am calling
In Kernel.php I have:
So I am honestly a bit confused why it even is able to authenticate via session cookies right now. Now if I load the UI without this package enabled and then trigger these API requests, they work fine. But if I load the UI with the package enabled, they fail with an So I take this to show that the issue is happening on the Javascript side based on the headers we respond with once the package is enabled. However the session cookie is still passed by the API call when this package is enabled. I realize I am asking you to debug my application here without access to the code. I can promise that I will submit documentation if we figure this out. |
Maybe you could try recreating the issue with a fresh Laravel project. That way, I can help you more accurately. |
After enabling this package using the defaults, Livewire still seems to work as expected but custom Javascript calls to
fetch
no longer pass the session cookie.Any idea what setting is causing this?
The text was updated successfully, but these errors were encountered: