Search code examples
struts2ionic3

Session Cookie Lost when using ionic native advanced http


I'm using cordova-plugin-advanced-http to solve CORS issue in iOS but there's one issue i'm facing and I'm really out of idea on solving this.

On my backend server, once user logged in, there will be one session cookie used to store user info. User is expected to see his/her logged in account in the in-app-browser once the user is logged into the mobile application. However, when I logged into the mobile application and click to open the in-app-browser, the cookie was null.

This issue only happened when using this plugin. When I tried using angular http in android, there is no such issue.

I tried setting cookie but the issue still persists. Can you please give me some directions on how I should tackle this issue?


Solution

  • I ended up solving this issue by using this. Not sure if it's just workaround or a proper solution.

    Update

    Workaround only – Not a perfect solution

    I changed the web view option of my ionic app. WKWebView ===> UIWebView

    First, open config.xml and add the following properties

    <feature name="CDVWKWebViewEngine">
      <param name="ios-package" value="CDVWKWebViewEngine" />
    </feature>
    <preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
    

    then run the following commands – I hope you are familiar with this commands

    ionic cordova plugin remove cordova cordova-plugin-ionic-webview --save
    
    rm -rf platforms/
    
    rm -rf plugins/
    
    ionic cordova build ios