Keycloak 18 + React logout issue

I’m using keycloak-react/web and keycloak-js packages in my React project. This is what I have in my keycloak.js

import Keycloak from 'keycloak-js'

const keycloak = new Keycloak({
  url: `http://localhost:8080/auth`,
  realm: 'demo',
  clientId: 'demo',
})

export default keycloak

The user is logged-in via Google IDP and this is how I logout:

{
  !!keycloak.authenticated && (
    <li>
      <a href='/#' onClick={() => keycloak.logout()}>Logout</a>
    </li>
  )
}

This used to work fine till I switched to keycloak v18.x.x Quarkus. I updated the JavaScript adapter (keycloak-js) to v19.0.1 which at least logs-out the user now but still haven’t figured out how to redirect back to the login page.

What I understand from the release notes is that the mechanism to logout has been changed. But what I don’t understand is how and where do I use this post_logout_redirect_uri or any other method, as a matter of fact, to just redirect back to login

The relevant documentation is here: Server Administration Guide

The new relaying party (RP) initiated logout needs the id_token and a post_logout_redirect_uri.

This post logout uri needs to be pre-registered in the server, just like the redirect uri.

Maybe you didn’t registered it when the server was upgraded?

I’m sorry but I’m quite new to this and don’t understand by what you mean when you say “pre-register the post logout uri in the server”. The only thing I did was download Quarkus v18.0.2 and run this command

./kc.sh start-dev --http-enabled true --http-relative-path /auth --hostname-strict-https false --hostname-strict false --proxy edge

I do see a .conf file, do I have to declare the post logout uri parameter there?

This can be done at Keycloak’s web interface, on the client configuration.