Auth0 Home Blog Docs

Stop LogoutAsync(true) window persisting

logout
wpf
net-core
#1

I’m using Auth0 (Auth0.OidcClient) for authentication in a .net core WPF app. I sign in using Auth0Client.LoginAsync() and have social login available. When I want to log a user out, I call Auth0Client.LogoutAsync(true) with federated set to true to sign out of the social account. However, this brings up a window after logging out that looks like this:

which the user has to close. Is there any way to make this window close automatically?

#2

So I’ve found that you can do something along the lines of:

WindowCollection WC = Application.Current.Windows;
Window logoutWindow = null;
foreach (Window window in WC) {
    if(window.Name == "WebAuthentication") {
        logoutWindow = window;
    }
}

and from there, get the WebBrowser object (from the window’s content -> children) and when the browser’s Navigated event occurs, the logout is complete so logoutWindow.Close();

Is this the best way to do what I want or should I be doing it some other way?