/// <summary> /// Signs the user out of the service. /// </summary> public static async void SignOut() { IEnumerable <IAccount> accounts = await IdentityClientApp.GetAccountsAsync(); foreach (var account in accounts.ToArray()) { await IdentityClientApp.RemoveAsync(account); } graphClient = null; }
/// <summary> /// Logout the user using the V2 endpoint asynchronous /// </summary> /// <returns>Success or failure</returns> public async Task <bool> LogoutAsync() { try { IAccount account = (await _identityClient.GetAccountsAsync()).FirstOrDefault(); await _identityClient.RemoveAsync(account); } catch (MsalException) { return(false); } return(true); }