I am developing a desktop application in WPF with C #, which connects to an Azure AD application, when trying to log out of the official documentation, it only deletes the cache but does not log out of the application, so when trying to connect again I already appear as disconnected
This is my code for login, but it doesn't work.
//cerrar sesion y volver a pantalla de menu
public async void cerrarSesion()
{
var accounts = await app2.PublicClientApp.GetAccountsAsync();
if (accounts.Any())
{
try
{
System.Diagnostics.Process.Start("https://login.microsoftonline.com/4fb44f4b-6f0e-46f2-acea-ac4538df0c9c/oauth2/v2.0/logout");
await app2.PublicClientApp.RemoveAsync(accounts.FirstOrDefault()).ConfigureAwait(false);
Console.WriteLine("User has signed-out");
//NavigationService.Navigate(new Menu());
// System.Diagnostics.Process.Start("https://login.microsoftonline.com/4fb44f4b-6f0e-46f2-acea-ac4538df0c9c/oauth2/v2.0/logout");
// Console.WriteLine(Resultado.Account.HomeAccountId + "");
}
catch (MsalException ex)
{
Console.WriteLine($"Error signing-out user: {ex.Message}");
}
}
}