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

Custom HOSTNAME / SCHEME break cookies support #312

Open
FarhadG opened this issue Feb 20, 2019 · 2 comments
Open

Custom HOSTNAME / SCHEME break cookies support #312

FarhadG opened this issue Feb 20, 2019 · 2 comments

Comments

@FarhadG
Copy link

FarhadG commented Feb 20, 2019

I've build a simple POC showcasing cookies working with the WkWebView (using this plugin). It works great with the default hostname and scheme (i.e. ionic://localhost). However, after changing the hostname and/or scheme, 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.

@EiyuuZack
Copy link

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?

@afulkersonApollo
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants