I'm using the following code within the onPageFinished() of a WebViewClient to read the cookies . But some cookies are set "SameSite=Strict", which I cannot get using the method below:
@Override
public void onPageFinished(WebView view, String url){
String cookies = CookieManager.getInstance().getCookie(url);
Log.d(TAG, "All the cookies in a string:" + cookies);
}
Can anybody tell me how to get the cookies which are set "SameSite=Strict" ?
It is officially a bug in Chromium and needs to be (hopefully will be) fixed there.
This was fixed in WebView 72. If you're not getting the SameSite
Lax
or Strict
cookies, you need to update the System WebView implementation to any version >= 72
David's post has a link to the bug and I have just confirmed after updating from version 70 to 80 that the CookieManager
instance is now getting ALL cookies.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With