Keycloak JavaFX Desktop App Adapter: after successfully authenticated received token but the browser tab shows : We are sorry... Page not found

Hi folks,
This forum is super helpful, thanks for all time and efforts you put here.
I am developing a JavaFx desktop application following installed-adapter.adoc
this is my public keycloak.json

{
  "realm": "xyz",
  "auth-server-url": "https://keycloak.xyz.com/auth",
  "ssl-required": "external",
  "resource": "xyz-mobile",
  "public-client": true,
  "confidential-port": 0,
  "use-resource-role-mappings": true,
  "enable-pkce": true
}

and the Java code just copy/paste from the documentation [installed-adapter.adoc] I added nothing more.

My JavaFX was able to open browser tab, login form, then I logged in successfully, , received token everything is great, but I notice after getting the token I got redirected to this link:
https://keycloak.xyze.com/auth/realms/xyzecoin/protocol/openid-connect/delegated
with message in the opened browser tab:

We are sorry… Page not found

While the JavaFx application got the token, but the user will be confused if found that browser tab show the message.We are sorry... Page not found,
I want to close tab automatically or tell them everything thing is fine, please close the tab.

Any idea why I am getting redirected to openid-connect/delegated instead of the page that shows please close your browser like in mobile app and what is the missing configuration?

did you find a solution to use it within JavaFX?

A JavaFX app I was working on used JxBrowser. JxBrowser can intercept navigation events and bury the call to /delegated. You’re probably not using JxBrowser, but the approach might work for the standard WebView/Engine if you launch the Keycloak login that way.

If you’re relying on the desktop browser, you might consider an embedded browser to have more control.

“br” below is a JxBrowser Browser object.

    br.navigation().set(StartNavigationCallback.class, params -> {
        // this keycloak endpoint was removed and returning "Page not found" after a successful login
        if (params.url().contains("/delegated")) {
            return StartNavigationCallback.Response.ignore();
        }
        return StartNavigationCallback.Response.start();
    });

Interesting solution. Thanks for the feedback. It would be interesting if one can navigate on WebView in a similar way.