Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova InAppBrowser and shared cookie with webview

Apparently, InAppBrowser does not store the current session cookie when using _blank on Android. Is there some setting that I'm missing in order to make this possible? It seems to work flawlessly on IOS and is mildly frustrating to troubleshoot. The cookie needs to be there for when the callback from oAuth happens and my server reads and assigns the current session the needed data.

What I have tried...

1) Adding CookieManager to android Childbrowser (old, I know)

2) target = _self will actually send the cookie to the server, but the popup that is opened closes the whole app (instead of the popup) after authentication and must be reopened manually

3) Changing various WebView properties and settings to no avail.

like image 534
cyber_dave Avatar asked Feb 21 '15 07:02

cyber_dave


2 Answers

Upon delving further into my problem, I've found that the InAppBrowser utilizes normal webview while my app ran using Crosswalk webview, thus the two became disjointed as a result.

I solved this problem by removing Crosswalk, for now.

My project was using Ionic#1.3.11 w/ the Ionic Crosswalk browser if anyone is curious.

If anyone has a suggestion or work-around for the cookie issue in Crosswalk, it would be greatly appreciated.

like image 158
cyber_dave Avatar answered Sep 21 '22 04:09

cyber_dave


It appears that Crosswalk prevents you from passing a cookie to the inAppBrowser on Android devices. After a ton of digging I found a forum discussion about the issue and a possible solution:

https://forum.ionicframework.com/t/crosswalk-and-inappbrowser/25139

https://github.com/Shoety/cordova-plugin-inappbrowserxwalk

Our team hasn't tested/implemented this yet, but it looks promising.

like image 31
Mark Hillard Avatar answered Sep 20 '22 04:09

Mark Hillard