Handling Login Failure with KeycloakInstalled

Hi,

I’m authenticating a desktop client. This code is working for me when I provide valid credentials.

            KeycloakInstalled keycloak = new KeycloakInstalled();
            keycloak.loginDesktop();
            AccessToken token = keycloak.getToken();

However, if there is a login error – even one that exceeds the Brute Force Detection – my app is still left waiting. Is there a listener or other technique that I can use to trap this condition and close out my desktop app? I’m looking for something that will work with both a max failed attempts or a closing of the browser without providing credentials.

Thanks,
Carl