DeleteCookies() does not work on Android

DON_T_PANIC_
Mon, 02 Aug 2021 08:04:34 +0000
Community & Industry Discussion

Hello together,

I am recently implementing an authentification process for Windows and Android using the SWebBrwoser. I got the authentication itself to work, but now I want to implement a function so that the user can end the session. My initial thought was to just delete the cookies from the SWebBrowser widget using the IWebBrowserCookieManager::DeleteCookies() function. And it works like a charm…on windows.
On Android it does nothing. Here is the code I am using:

IWebBrowserSingleton* WebBrowserSingleton = IWebBrowserModule::Get().GetSingleton();
if(WebBrowserSingleton)
{
    TSharedPtr<IWebBrowserCookieManager> CookieManager = WebBrowserSingleton->GetCookieManager();
    if(CookieManager.IsValide())
    {
        TFunction<void(int)> CookieDeletedCallback = ([&](int count) {
            UE_LOG(LogTemp, Display, TEXT("%d cookies deleted."), count);
        });
        CookieManager->DeleteCookies("","", CookieDeletedCallback);
    }
}

On windows the callback prints out "5 cookies deleted. The very same code with the very same process beforehand the callback prints out “0 cookies deleted”.

Has anybody an idea what I am doing wrong. Maybe something with the android permissions?

1 post - 1 participant