Since we upgraded from the old UIWebView engine, we are not able to authenticate our users (using an external auth service), as none of the cookies sent by the APIs are being set in the this web view.
This is a major blocker for us and have been trying to determine what a good course of action is. If our assumptions are correct that cookies are not supported with this web view (which is very strange), we are going to try:
Our stack:
I'm also experiencing the same issue.
After verifying details on my login.html it redirects it to menu.html and within this I do 3 separate HTTP $_GET requests. I inspected this through Firefox and I can see that the PHPSESSID are different for each request, while on Android it's completely fine and persists.
I haven't found a fix yet.
Yeah, this has been driving us crazy over the past couple of weeks, @aecvargas
Same issue here. I installed this plugin in my Cordova project and cookies work fine on Android but not on iOS! :(
@FarhadG @gabriele-bjss
I don't know if you guys have seen the potential solution found in this article:
https://novemberfive.co/blog/WKWebView-redirect-with-cookies
But I'm not entirely sure how to apply this fix to my ionic/cordova app as it is all in .swift and I am not familiar with swift at all.
Same issue here. Would be nice if it will be fixed.
I can get them to work, but just after killing the app as on https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/22, so going to close as duplicate.
Make sure you have xhr.withCredentials = true; if using XHR or credentials: 'include' if using fetch. That's required for cookie credentials to work on WKWebView while it wasn't on UIWebView.
They can also work if you set <preference name="Hostname" value="" /> to match the host where you are making the calls to, but it's not really a good solution as might break the Android app unless you change the scheme to not match your server one. (I.E. if you call to https://yourserver.com/file.json and you have <preference name="Hostname" value="yourserver.com" /> and <preference name="Scheme" value="https" /> it will be intercepted and look for a local file instead of for the remote one, if you set the scheme to http or ionic it will work, but might have some other problems.
@jcesarmobile I've got this all set up which is why it works for my Android version. It does work for the iOS but once the app has been ran once but it shouldn't have to work like that. It is still an issue for iOS on WKWebView.
From what I have gathered upon researching this is that this issue has been around for at least a couple of years now and Apple has not added a fix for it and I don't think there will be any fixes either. Some people have created cordova/ionic plugins to allow the cookies to work for WKWebView but this only works for iOS 11+ I believe. An alternative is to this is to switch back to UIWebView which isn't really ideal but it does work.
I鈥檝e closed it because there is another issue open (#22)
this plugin is working for me https://github.com/lucky3491/cordova-plugin-wkwebview-inject-cookie
this plugin is working for me https://github.com/lucky3491/cordova-plugin-wkwebview-inject-cookie
I am building an app with Ionic and Angular and would like to use your plugin but am having issues. When I install the plugin and try to import it, it's not available to use. Is there something I'm missing here?

@juliannehalversen simply declare a normal variable as follows:
declare var wkWebView: any;
Are there any updates?
Are there any updates?
Here is the link to what I did to fix it: https://github.com/lucky3491/cordova-plugin-wkwebview-inject-cookie/issues/1#issuecomment-633614645
Most helpful comment
Here is the link to what I did to fix it: https://github.com/lucky3491/cordova-plugin-wkwebview-inject-cookie/issues/1#issuecomment-633614645