Caching Cookies in inappbrowser iOS 10(clearcache=no;) not working when app restarts - Cordova/Ionic

Elaborating on answer from @Sourav Das so that it may be useful for others.

If your authentication scheme is only SAML based you do not have any option but depend on cookies set by the Identity Provider.

The cookies set by IdPs generally are sessionOnly cookies without any expiry date. Android WebView saves these sessionOnly cookies along with other cookies(i.e. with expiry dates) between app restarts (kill and reopen) but iOS based WebViews do not save sessionOnly cookies. Only cookies with expiry date are saved in iOS.

If the intention of iOS app developer is to retain the sessionOnly cookies as well between app restarts - there are 2 ways to do this.

  1. Implement a custom cordova plugin based on the logic at https://stackoverflow.com/a/5938927/6243

  2. Use Cookie Emperor plugin if you know the exact name by which your sessionOnly cookies will be set. You can read/write using this plugin at JavaScript layer instead of dealing with native iOS code.