-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
[bug] http plugin does not store http-only cookies on cookie storage #11518
[bug] http plugin does not store http-only cookies on cookie storage #11518
Comments
I've tried setting the cookie as non-http-only, and I got the same issue: cookies are available during the session (although still not visible in the devtools cookie inspector), but not persisted. |
if using the http plugin, cookies and requests will not show in the devtools inspector at all as the requests are made through Rust.
I see, this is because the cookies jar is created each time the app is started and not persisted on disk. This part we can improve. |
Is it possible to use XHR directly, without relying on the http plugin? The problem with the plugin is those cookies are required for other things than fetch, like EventSource (SSE). On a browser, the cookie storage is shared, so if you get a cookie set via an HTTP request, that cookie will be sent back with EventSource messages, but that's not the case with the plugin. And, given that the plugin does not expose any kind of cookie, there is no workaround possible (aside of not relying on cookies for authentication / JWT). |
you can use XHR or the built-in fetch directly, and it will store and load cookies as needed The tauri http client is not 100% replacement and it will never be (although it tries to be very close). You should only use the tauri http client when there is a good reason for it, like bypassing CORS. |
I think I'm missing something (maybe you can point me in the right direction?): using XHR for requests works, but I'm not getting any cookie in the response, while the same request on a browser, returns a cookie. Is there anything specific I need to set in order to be able to get cookies back from a remote API? The request itself hits the remote server and gets a response back, it's just the cookies that should be there that I'm missing. |
which browser did you try with? could you see if |
I've done a bunch of testing, and this is the scenario:
In both Tauri cases, I could not change the domain to the API's to check if the cookie was actually available in the storage. |
you could try directly with one of the examples in |
That could be an option, but kind of defeats my idea of using tauri: I was expecting to just package the SPA app within tauri, fix the base paths that would need fixes and be done, but not having basic cookie management (with similar behavior to what the web does), becomes a blocker. Maybe is that my expectations are not correct, but IMHO being able to perform authenticated REST calls to external services is a must. I'll try to perform the fix on tauri myself, although I'm not proficient on Rust yet (WIP). If I manage to get it done, I'll raise a PR. |
I am suggesting to use |
I just tried and I can see the cookies just fine in the network tab, feel free to make a minimal repro and I will be happy to check it |
Describe the bug
I have a session cookie (http-only) returned as part of the authentication process, which is handled by Tauri's HTTP Client plugin.
Any request that is handled by the client (within the current session), includes the received cookie, but:
Reproduction
No response
Expected behavior
HTTP Client should persist http-only cookies as part of the cookie storage.
I've set CSP settings to include the remote address, but that did not work either:
Full
tauri info
outputStack trace
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: