How to Log Out Users with .NET MAUI

Overview

This article provides steps to log out users from a .NET MAUI application.

Applies To

  • .NET
  • MAUI
  • Logout

Solution

Follow the Auth0 MAUI Sample Logout application:

  • Create an instance of the Auth0 client:
Auth0Client client = new Auth0Client(new Auth0ClientOptions

{

  Domain = "",

  ClientId = "",

  RedirectUri = "myapp://callback",

  PostLogoutRedirectUri = "myapp://callback",

  Scope = "openid profile email"

});
  • Use the LogoutAsync method:
await client.LogoutAsync();