fluttercommunity / flutter_webview_plugin

Community WebView Plugin - Allows Flutter to communicate with a native WebView.
https://pub.dev/packages/flutter_webview_plugin
Other
1.48k stars 929 forks source link

session cookie for cross domain websites #887

Open edmundackah opened 3 years ago

edmundackah commented 3 years ago

By getting the cookie through js, most websites will do cross-domain security processing, so it is basically impossible to get the value of the session, it makes no sense.

Changing the cookie method to the following implementation addresses this issue.

void getAllCookies(MethodCall call, final MethodChannel.Result result){ String url = call.argument("url"); CookieManager cookieManager = CookieManager.getInstance(); String cookieStr = cookieManager.getCookie(url); result.success(cookieStr); }

Currently making the change locally, will be great to have the fix built into the plugin. See this article for a detailed implementation for iOS and Android.

dhcracchiolo commented 3 years ago

@edmundackah You are a life saver bro! Thank you so much!
+1 For adding this in the official version