0

All,

Just wanted to know if it is possible to access the mobile browser cookie through Worklight app? Has anyone tried this before? Is it even possible with Cordova plugins or any other viable approach?

The typical use case is when the user clicks on any URL(view website) in the Worklight app that will direct to mobile website which will be opened on the mobile web browser(Safari or Chrome). And when the user logs out of the website on the mobile browser, we want the app to be logged out as well. The next time user gets the app to foreground, user should be challenged for authentication. So how we do access the browser cookie/cache to see if the user is logged out of the website on the mobile browser?

Thanks Paul

Paul Raj
  • 103
  • 12
  • 1
    I think you are asking one thing: "can cookies be accessed in a Worklight app" - while what you should really ask first is: "Can my website and my worklight app SHARE cookies". And I think the answer to that is NO - because cookies are restricted by domain names / hosts. – Nathan H Apr 10 '14 at 08:33
  • The following question and article may be helpful here: http://stackoverflow.com/questions/17700910/attaching-cookie-to-worklight-adapter-response-header and http://www.ibm.com/developerworks/library/mo-worklight-linkedin/ – nspeete Apr 10 '14 at 14:08
  • @NathanH, Thanks for your reply. The generic question is that if there is a way to access mobile browser cache from within Worklight app. When the user opens a tab in Mobile browser and logs in to Wal-mart web site to see his ordered items, the authentication info is stored in mobile browser cache. So is there a way we can access that cache from Worklight app? – Paul Raj Apr 10 '14 at 16:36

1 Answers1

2

For security reasons, the WebView's cache/cookies of your Worklight application are locked in the sandbox of your application.

Other applications (including the built-in browsers that comes with the phone) cannot access cache and cookies from the Worklight application, and vice-versa.

Nathan H
  • 48,033
  • 60
  • 165
  • 247