Skip to content
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

Cookies cannot be set on macos #2590

Closed
helloxz opened this issue Apr 13, 2023 · 14 comments
Closed

Cookies cannot be set on macos #2590

helloxz opened this issue Apr 13, 2023 · 14 comments
Labels
awaiting feedback More information is required from the requestor Bug Something isn't working

Comments

@helloxz
Copy link

helloxz commented Apr 13, 2023

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

@helloxz helloxz added the Bug Something isn't working label Apr 13, 2023
@leaanthony
Copy link
Member

Is your expectation that webviews support cookies? Do they?

@helloxz
Copy link
Author

helloxz commented Apr 13, 2023

  • wails dev(support cookies)
  • wails build(not suppot cookies)

I hope the wails build can also support setting cookies

@helloxz
Copy link
Author

helloxz commented Apr 14, 2023

Excuse me, have you reproduced this BUG?

@evorts
Copy link

evorts commented Apr 14, 2023

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

@misitebao
Copy link
Contributor

It is not recommended to use Wails as a browser. 👀

@leaanthony
Copy link
Member

Yeah, Wails doesn't bundle a browser.

@helloxz
Copy link
Author

helloxz commented Apr 16, 2023

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.

@leaanthony
Copy link
Member

When you say "development mode", do they work in the app (not the browser)?

@helloxz
Copy link
Author

helloxz commented Apr 17, 2023

When you say "development mode", do they work in the app (not the browser)?

Yes, it works in the application, not in the browser.

@leaanthony
Copy link
Member

@helloxz - Can you please retest with the latest version. Thanks.

@leaanthony leaanthony added the awaiting feedback More information is required from the requestor label May 21, 2023
@adityak368
Copy link

adityak368 commented Jul 24, 2023

This looks like an issue. I am not able to set cookies even on windows. It fails both dev and build mode

@airtonix
Copy link

airtonix commented Aug 7, 2024

yeah responses will show that there are cookies, but it looks like that there is no cookie storage implemented.

image

image

@gj1118
Copy link

gj1118 commented Aug 31, 2024

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
image
I dont see this issue when I visit the url directly in Safari . I am on MacOS

@leaanthony
Copy link
Member

Moving all cookie related feedback to #3908

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting feedback More information is required from the requestor Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants