pichillilorenzo / flutter_inappwebview

A Flutter plugin that allows you to add an inline webview, to use a headless webview, and to open an in-app browser window.
https://inappwebview.dev
Apache License 2.0
3.29k stars 1.62k forks source link

Required Cookies Not Sent on Android #2392

Open njovy opened 1 week ago

njovy commented 1 week ago

Is there an existing issue for this?

Current Behavior

I am using this plugin to log in to a third-party service, which relies on cookies to verify if a user is authenticated. While the same code functions correctly with flutter_webview and works without issues on iOS, the inappwebview plugin on Android fails to send the required cookie provided by the server. Due to this, I currently have to use flutter_webview for Android users to log in. I am unsure which specific cookie is missing. I have researched this issue, and although several developers have raised similar concerns, I haven't found a solution. I believe there may be a bug in inappwebview on Android where certain cookies are not being set correctly.

Expected Behavior

The cookie is set correctly.

Steps with code example to reproduce

Don't have code to reproduce yet.

Stacktrace/Logs

NA

Flutter version

v3.24.4

Operating System, Device-specific and/or Tool

SM F721N (mobile) android-arm64 Android 12 (API 32)

Plugin version

v6.1.5

Additional information

No response

Self grab

pichillilorenzo commented 1 week ago

Could you try the new version 6.2.0-beta.1?

njovy commented 5 days ago

@pichillilorenzo Unfortunately, updating to 6.2.0-beta.1 didn’t resolve the issue I'm experiencing. I’m temporarily using flutter_webview on Android and continuing with this plugin on iOS until this issue is resolved. I’ll provide further details later to help identify the cause.

njovy commented 5 days ago

@pichillilorenzo, I opened chrome://inspect, debugged a request by copying it as cURL, and noticed that a few headers were missing. This request is initiated by JavaScript, and for the same request on the same site, the cookie header appears with flutter_webview, but inappwebview does not set the cookie when the request is sent.

pichillilorenzo commented 5 days ago

Maybe this could be caused by the shouldOverrideUrlLoading event. Please, post your current InAppWebView implementation with all the InAppWebViewSettings you are using. Also, try a way to share steps and possible code to reproduce the issue, thanks.