From e193aa7c1cfce329b38594c3e50bc393b7856b20 Mon Sep 17 00:00:00 2001 From: Khwezi Mngoma Date: Sun, 7 Jun 2026 13:56:49 +0200 Subject: [PATCH] Adopted standard logout flow --- LiteCharms.Features/Extensions/Api.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/LiteCharms.Features/Extensions/Api.cs b/LiteCharms.Features/Extensions/Api.cs index 84c087d..f1b2bda 100644 --- a/LiteCharms.Features/Extensions/Api.cs +++ b/LiteCharms.Features/Extensions/Api.cs @@ -104,13 +104,12 @@ public static class Api app.MapGet("/logout", async (HttpContext context) => { - var schemesToSignOut = new[] { CookieAuthenticationDefaults.AuthenticationScheme, OpenIdConnectDefaults.AuthenticationScheme, }; + await context.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme); - string postLogoutRedirectDestination = "/"; - - await context.SignOutAsync(scheme: null, properties: new AuthenticationProperties { RedirectUri = postLogoutRedirectDestination, }); - - foreach (var scheme in schemesToSignOut) await context.SignOutAsync(scheme); + await context.SignOutAsync(OpenIdConnectDefaults.AuthenticationScheme, new AuthenticationProperties + { + RedirectUri = "/", + }); }); return app;