cordova-plugin-ionic-webview icon indicating copy to clipboard operation
cordova-plugin-ionic-webview copied to clipboard

Cookies are not stored on set cookie response header

Open horodnicdragos opened this issue 7 years ago • 5 comments

I'm not sure if my issue is related to this one (https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/22) but when I use this plugin in the simulator cookies are never set by setCookie from response headers provided by my backend on login. It doesn't matter how many times I make this request, the cookies are never set. I can login just fine when I run the app from my device, and according to the logs from the backend, the cookie is set on all following requests.

Here is my ionic info output:

ionic/cli-utils : 1.19.1 ionic (Ionic CLI) : 3.19.1

global packages:

cordova (Cordova CLI) : 7.1.0

local packages:

Cordova Platforms : none
Ionic Framework   : ionic1 1.3.5

System:

ios-deploy : 1.9.1
ios-sim    : 5.0.13
Node       : v8.9.1
npm        : 5.6.0
OS         : macOS High Sierra
Xcode      : Xcode 9.2 Build version 9C40b

Environment Variables:

ANDROID_HOME : not set

Misc:

backend : pro

Any clues?

horodnicdragos avatar Feb 07 '18 14:02 horodnicdragos

I'm facing exactly the same problem. It's working fine for me too on real devices. But no luck with the simulators. However, the cookie info seems to be included in the request header if "localhost" is the server. One thing to note here is, it doesn't work if I replace "localhost" with my local IP.

frenmanoj avatar Feb 07 '18 17:02 frenmanoj

Same issue here.

Using WKWebView and PouchDB that requires authentication cookies, never works on Simulator. Switching to UIWebView then works ok on Simulator. Fine on real device.

Not sure if its related to this bug regarding simulator being case sensitive for headers:

https://stackoverflow.com/questions/44315389/ios-httpurlresponse-header-field-case-sensitivity

sjdrew avatar Mar 22 '18 14:03 sjdrew

Solution https://novemberfive.co/blog/WKWebView-redirect-with-cookies

DimitryDushkin avatar Jan 15 '19 07:01 DimitryDushkin

@DimitryDushkin I don't quite understand on how to apply this fix.

I am working with Ionic1/AngularJS and have set up Android and iOS platforms via ionic/cordova commands.

allanevargas avatar Feb 07 '19 16:02 allanevargas

Try this. Works without any plugins https://github.com/CWBudde/cordova-plugin-wkwebview-inject-cookie/issues/11#issuecomment-883249020

rafaellop avatar Jul 20 '21 09:07 rafaellop