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

Cookies not working on iOS 13.3 beta #475

Closed
kas84 opened this issue Nov 14, 2019 · 20 comments
Closed

Cookies not working on iOS 13.3 beta #475

kas84 opened this issue Nov 14, 2019 · 20 comments

Comments

@kas84
Copy link

kas84 commented Nov 14, 2019

Hi, since iOS 13.3 beta I am having issues with cookies not setting correctly on a cordova app.

I am using the latest version of ionic-webview:
cordova-plugin-ionic-webview 4.1.3 "cordova-plugin-ionic-webview"
I attach login response with set-cookie headers
cookie failure
And then check user get http without any cookie set.

cookie-failure-2

Anybody else experience this bug?

@NiklasMerz
Copy link
Contributor

This is most likely a Webkit bug

@kas84
Copy link
Author

kas84 commented Nov 14, 2019

Yes, seems like it, thanks! In case they don't fix it... is there a way to change http calls to go from a webkit http request to a native http request? I've checked https://ionicframework.com/docs/native/http, is there an easy way to integrate this into ionic v1 angularjs $http requests?

By the way, this also happens on iOS simulators since 12.0+

@NiklasMerz
Copy link
Contributor

You might try #448 . I built this for cookie issues in the initial iOS 13 release. It works quite well if you can adjust all your URL to use the custom scheme.

@kas84
Copy link
Author

kas84 commented Nov 14, 2019

What does that mean? I am using local http to serve the ionic app. Would I need to move to custom scheme like ionic://** ?

@NiklasMerz
Copy link
Contributor

If you use the code from #448 via https://github.com/NiklasMerz/cordova-plugin-ionic-webview#schemehandler you can use the Javascript method window.Ionic.WebView.convertFileSrc() to convert your URLs.

Your HTTPS URL like https://example.com become /_https_proxy_example.com. This means your code will go through native methods of this plugin and you cookies will be set to the webview and all other requests.

@kas84
Copy link
Author

kas84 commented Nov 14, 2019

Oh, I see. So basically when using a get like $http.get("https://google.com"), I should do $http.get(window.Ionic.WebView.convertFileSrc("https://google.com")) and then it would go through the native layers?

@NiklasMerz
Copy link
Contributor

Oh, I see. So basically when using a get like $http.get("https://google.com"), I should do $http.get(window.Ionic.WebView.convertFileSrc("https://google.com")) and then it would go through the native layers?

Yes correct. Thats the idea of this PR. We call this 'proxy' because the HTTP requests are not done by Webkit but native URLSessions instead. This handles cookies correctly in the cookie store and syncs them to the webview.

@kas84
Copy link
Author

kas84 commented Nov 14, 2019

Awesome! I'll check it out! Thanks!

PS: It works!! Now I have a backup plan!

Many thanks @NiklasMerz

@kas84
Copy link
Author

kas84 commented Nov 21, 2019

On 13.3 beta 3 this bug is NOT fixed. I am not familiar with how Apple deploys versions, is there going to be a Golden Master before 13.3 goes mainstream?

That is, so we know for sure that they’re going to break this and need to go http native or not.

Sent with GitHawk

@NiklasMerz
Copy link
Contributor

NiklasMerz commented Nov 21, 2019

We will see if it gets merged in for 13.3 GA. Always a suprise unfortunately.

But it did work at some point in 13.2 so I have hopes they will fix this regression.

@kas84
Copy link
Author

kas84 commented Nov 21, 2019

I have the way around prepared with an if, but if I have to go http native and break sessions, I’d rather stay on http native even after they fix it.

Because I don’t want to break sessions twice

Sent with GitHawk

@kas84
Copy link
Author

kas84 commented Dec 5, 2019

Fixed by Apple on 13.3 beta 4

@kas84 kas84 closed this as completed Dec 5, 2019
@Lucaszw
Copy link

Lucaszw commented Jan 10, 2020

This is working for me on a physical iPhone, but the cookie problem seems to be persisting with the iOS simulator. Is anyone else still encountering this?

@NiklasMerz
Copy link
Contributor

NiklasMerz commented Jan 10, 2020 via email

@kas84
Copy link
Author

kas84 commented Jan 10, 2020 via email

@NiklasMerz
Copy link
Contributor

That was an iOS Webview Bug https://bugs.webkit.org/show_bug.cgi?id=204109

@kas84
Copy link
Author

kas84 commented Jan 10, 2020

It still fails in my case.

iOS version: 13.2.2
Version of the simulator:
Version 11.2.1 (SimulatorApp-912.4 SimulatorKit-570.3 CoreSimulator-681.15).

I don't know if any other plugin might be interfering but it's still not working on my side.

@NiklasMerz
Copy link
Contributor

Make sure everything is updated. iOS 13 had some cookie issues. iOS 13.2 beta 2 fixed one. It broke after that in iOS 13.3 beta again and was fixes in iOS 13.3 beta 4. This is not a bug in the ionic webview plugin, but a bug in iOS. You need to find ways around that.

See those webkit bugs:
https://bugs.webkit.org/show_bug.cgi?id=200857

https://bugs.webkit.org/show_bug.cgi?id=204109

@alexsasharegan
Copy link

Both the simulator and the physical device are failing to include cookies. I tried the #448 code as well, but that just seems to crash my app.

iOS 13.3 (17C54)
Simulator Version 11.3.1 (SimulatorApp-912.5.1 SimulatorKit-570.3 CoreSimulator-681.17.2)

@danielsotopino
Copy link

danielsotopino commented Feb 12, 2020

Tested on simulator v13.3, not working.
Tested on device v13.3.1, it's working.

I'm going to check if v13.2 simulator works ok.

== EDIT ==
Tested on simulator v13.2 and works ok.

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

5 participants