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

Be able to set cookies on the client #13

Open
menelike opened this issue May 19, 2021 · 3 comments · May be fixed by #15
Open

Be able to set cookies on the client #13

menelike opened this issue May 19, 2021 · 3 comments · May be fixed by #15

Comments

@menelike
Copy link

Is your feature request related to a problem? Please describe.
If I am not mistaken (and sorry for the noise if I am),

[[[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if(error && (self.stoppedTasks == nil || ![self.stoppedTasks containsObject:urlSchemeTask])) {
@try {
NSLog(@"WebviewProxy error: %@", error);
[urlSchemeTask didFailWithError:error];
return;
} @catch (NSException *exception) {
NSLog(@"WebViewProxy send error exception: %@", exception.debugDescription);
}
}
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 risetechnologies/cookieTest#2 (comment)


Also thanks a lot @NiklasMerz for open sourcing your approach, IMHO this is a slim and neat way to tackle ITP issues! 🚀

@NiklasMerz
Copy link
Collaborator

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.

@menelike
Copy link
Author

menelike commented May 19, 2021

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)

@NiklasMerz
Copy link
Collaborator

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.

@menelike menelike linked a pull request Jun 1, 2021 that will close this issue
3 tasks
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

Successfully merging a pull request may close this issue.

2 participants