How to logout complete?

Hi, How I can logout in my application?
At the moment If I click “logout” in my app (c#), I can login automatically without edit the credentials. How I can disable this? The user should always edit the credentials after logout. Is there maybe an example?
Thanks in advance!

Hi @wojku,

Welcome to the Community!

There is a Windows Universal App C# Quickstart application that may serve as an example:

In the example app, it looks like to log out the user, you call await client.LogoutAsync(); like this:

private async void LogoutButton_Click(object sender, RoutedEventArgs e)
            BrowserResultType browserResult = await client.LogoutAsync();
            if (browserResult != BrowserResultType.Success)
                resultTextBox.Text = browserResult.ToString();
            // Hide logout button
            logoutButton.Visibility = Visibility.Collapsed;
            // Display login button
            loginButton.Visibility = Visibility.Visible;
            // Clean up form
            resultTextBox.Text = "";
            connectionNameAutoSuggestBox.ItemsSource = _connectionNames;
            audienceTextBox.Text = "";

Hello, what about
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
This code is from your examples, but it doesn’t work. Should I logout i another way? What about the cookie? Should I delete them manually?

Oh, I see! I was providing code for Windows Universal App C#, but await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme); is .NET (sorry, JavaScript/Python dev here :sweat_smile:!)

Here is the ASP.NET Core v3.1 quickstart: (.NET and .NET v2 Core are also available here:

Here is information from the GitHub README that explains how to log out users:

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.