cordova-plugin-webview-proxy
cordova-plugin-webview-proxy copied to clipboard
Be able to set cookies on the client
Is your feature request related to a problem? Please describe.
If I am not mistaken (and sorry for the noise if I am), https://github.com/GEDYSIntraWare/cordova-plugin-webview-proxy/blob/0e5bfc9274759e0a2af9c89072a59a7230c9dc15/src/ios/WebviewProxy.m#L50-L59 saves the server-set cookie. A cookie set on the client (document.cookie) won't be used in any request. It would be nice to set cookies on the client as well.
Describe the solution you'd like
Ideally, something like window.WebviewProxy.setCookie() with the same behavior as document.cookie should do the job.
Additional context
I am testing this in a Meteor/Cordova context where I had no luck with app-bound-domains. This issue explains the issue in conjunction with Meteor https://github.com/risetechnologies/cookieTest/issues/2#issuecomment-844036075
Also thanks a lot @NiklasMerz for open sourcing your approach, IMHO this is a slim and neat way to tackle ITP issues! 🚀
Thank you for your idea and kind words. This sounds like a really good. Unfortunately I probably won't be able to develop this myself soon, but I am happy to review and merge a pull request for this.
You could have a look #12 as this could be somewhat similar.
Thanks for your fast response, I will try to cover this in the upcoming weeks (I have no objC experience...yet).
The most important question for me is that my assumption about document.cookie not being used is a general Cordova issue and not strictly related to Meteor/Cordova, right? As a result this codebase only tackles cookies set by the server (this is not obvious reading the documentation/Readme)
I am not entirely sure but this document.cookie issue should be somthing wih the combination of WKWebView, the cookie pool and this proxy plugin.
I think it should relatively straigthforward to implement a function in this plugin to add cookies in the cookie pool the proxy uses.