WKWebView and cookies

Trying to go through the upgrade to WKWebView.
Doing the final round of testing and found a bug trying to use JavaScript document.cookie to set a temporary cookie. The reason I’m using a cookie is so I can set an expire date and prompt user again.

Cant find a way to get Javascript document.cookie to work in the new WKWebView version.
Any idea?

You can test https://github.com/psirenny/cordova-plugin-wkwebview-sync-cookies#readme
and https://www.npmjs.com/package/cordova-plugin-wkwebview-inject-cookie

Thanks for the suggestions.
I’m really confused why there is not a more official fix for these issues from either Cordova or Ionic.

Issue 1- Can’t set cookies from within WKWebView – document.cookie no longer works when using WKWebView. No official ionic fix? Nothing I can see in Ionic WKWebView documentation that warns about this problem with the upgrade to WKWebView (maybe it started in ios 11?)
Is there a way to allow cookies to be set. The only work around is to use local storage. I think?

Issue 2- Setting cookies fails on first load of app and first call with an API request. Seems to be an issue with WKWebView cookie manager (whatever it is call). I don’t know if its an initialization or timing issue.

Some of the suggested plugins seem to be forks of others. Not sure which one is the best to use and why?
Other suggestion is to go back to use local storage. The only way to read set-cookie from a request is allow from the server side.

access-control-expose-headers: Set-Cookie

I’m not sure of the security implications of doing such.

Is there any “official” fix for these issues?

Hello I remember this plugin https://github.com/silkimen/cordova-plugin-advanced-http ,
you can test the operation setcookie => https://github.com/silkimen/cordova-plugin-advanced-http#setcookie, I am not used, I thing you can help.

Thanks.
Furstrted there is not offical fix.
I was using this plugin
cordova-plugin-wkwebview-inject-cookie (or some version of it).
Worked fine in IOS 13.5 but does not work in ios 14+. I’m starting over.
Most of these plugins were written years ago. I don’t like using old plugins if I don’t have to.

Anybody have cookies working on startup with IOS 14+ ???

Bu in this plugin if you clear the app from background , use clearCookies() method it doesn’t works in IOS