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));
}
}我想清除操作系统浏览器上的cookies,这样就不会缓存MSAL登录凭据。
发布于 2019-07-09 22:01:08
已修复。
从Chrome自定义选项卡切换到嵌入式(WebView?)允许您通过CookieManager管理cookies。
App.UiParent = new UIParent(Xamarin.Forms.Forms.Context as Activity, true);
https://stackoverflow.com/questions/56952749
复制相似问题