Open FarhadG opened 5 years ago
On your POC's README.md it is mentioned:
Although cookies work with default settings, they are never visible. That is, developers cannot inspect cookies inside of Safari's devtools (under application cookie storage).
Another thing I've noticed is that document.cookie
is always empty. I have removed the httpOnly
flag from the cookie header sent in the response but it never shows up in document.cookie
.
What is even weirder is that if you use Safari's devtools to set a cookie (e.g. document.cookie="foo=bar"
) it is not set and document.cookie
remains empty, meaning JavaScript has no access to any cookies whatsoever.
Any ideas why this happens?
Can someone please give a clear explanation as to why cookies aren't available in the webview in iOS? I can get cookies to work AND THEY ARE VISIBLE IN DEV TOOLS if I set the hostname setting in capacitor.config.js to the same domain as the requests I'm making BUT the app we're creating is designed to be used with backends located at addresses the user inputs.
I've build a simple POC showcasing cookies working with the WkWebView (using this plugin). It works great with the default
hostname
andscheme
(i.e.ionic://localhost
). However, after changing thehostname
and/orscheme
, cookies no longer work.Here's a the link the REPO with steps on how to reproduce the issue.
Thank you, in advance, for the help.