![](/img/trans.png)
[英]Xamarin Android CookieManager doesn't store all cookies
[英]Xamarin Android CookieManager unable to remove cookies
Xamarin Android CookieManager.hasCookies()返回false,表示沒有cookie。
public static async Task<string> SignOut(){
IEnumerable<IAccount> accounts = await App.IdentityClientApp.GetAccountsAsync();
foreach (IAccount account in accounts)
{
await App.IdentityClientApp.RemoveAsync(account);
}
DependencyService.Get<ILogoutHelper>().LogoutSSO();
graphClient = null;
TokenForUser = null;
return "";
}
public class LogoutHelper : ILogoutHelper
{
public void LogoutSSO()
{
CookieManager.Instance.RemoveAllCookies(null);
CookieManager.Instance.RemoveAllCookie();
CookieManager.Instance.RemoveSessionCookie();
CookieManager.Instance.Flush();
Device.BeginInvokeOnMainThread(() => new Android.Webkit.WebView(null).ClearCache(true));
}
}
我想清除OS瀏覽器上的cookie,以便不緩存MSAL登錄憑據。
固定。
從Chrome自定義標簽切換到嵌入式(WebView?),可以通過CookieManager管理cookie。
App.UiParent = new UIParent(Xamarin.Forms.Forms.Context as Activity, true);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.