Cookies cannot be set on macos
Description
I am on the macos platform. I can normally set cookies in dev mode, but setting cookies after build is invalid.
I did a comparison check with debug mode and found this to be the case.
To Reproduce
run wails dev ok
document.cookie = "username=John Doe; expires=" + new Date(new Date().getTime() + (24 * 60 * 60 * 1000)).toUTCString() + "; path=/";
run wails build -debug failed
document.cookie = "username=John Doe; expires=" + new Date(new Date().getTime() + (24 * 60 * 60 * 1000)).toUTCString() + "; path=/";
Expected behaviour
Cookies can be set correctly and effectively
Screenshots
No response
Attempted Fixes
No response
System Details
Wails CLI v2.4.1
Scanning system - Please wait (this may take a long time)...Done.
# System
OS | MacOS
Version | 13.3.1
ID | 22E261
Go Version | go1.20.3
Platform | darwin
Architecture | amd64
# Wails
Version | v2.4.1
# Dependencies
Dependency | Package Name | Status | Version
Xcode command line tools | N/A | Installed | 2397
npm | N/A | Installed | 9.5.0
*Xcode | N/A | Available |
*upx | N/A | Installed | upx 4.0.2
*nsis | N/A | Available |
* - Optional Dependency
# Diagnosis
Your system is ready for Wails development!
Optional package(s) installation details:
- Xcode: Available at https://apps.apple.com/us/app/xcode/id497799835
- nsis : More info at https://wails.io/docs/guides/windows-installer/
♥ If Wails is useful to you or your company, please consider sponsoring the project:
https://github.com/sponsors/leaanthony
Additional context
No response
Is your expectation that webviews support cookies? Do they?
wails dev(support cookies)wails build(not suppot cookies)
I hope the wails build can also support setting cookies
Excuse me, have you reproduced this BUG?
In my opinion, having no cookie support does not posed a critical issue. Since it can be handled by either LocalStorage (which hadn't been an issue for me) or perhaps by the golang/backend side of the wails app. Cookie imho much more appropriate for web development which run on full fledge browser. Again, this is just my opinion
It is not recommended to use Wails as a browser. 👀
Yeah, Wails doesn't bundle a browser.
Yeah, Wails doesn't bundle a browser.
It's a bit strange that cookies are supported in development mode, but not after packaging. This issue doesn't exist on Windows. What could be the reason? I've temporarily switched to using localStorage to work around this problem.
When you say "development mode", do they work in the app (not the browser)?
When you say "development mode", do they work in the app (not the browser)?
Yes, it works in the application, not in the browser.
@helloxz - Can you please retest with the latest version. Thanks.
This looks like an issue. I am not able to set cookies even on windows. It fails both dev and build mode
yeah responses will show that there are cookies, but it looks like that there is no cookie storage implemented.
Same is the case with me.. I am using securetokens to handle authentication. SecureTokens will try to set the cookie, but I am getting the following error
I dont see this issue when I visit the url directly in Safari . I am on MacOS
Moving all cookie related feedback to #3908