When new tokens are get in Keycloak, previous sessions are not closed

A new session is created every time I get tokens from Keycloak. Every time I get a token, I want the previous sessions to be closed. I have not seen such a service on the Keycloak side. What method can be developed for this?

Keycloak version: 19.0.0

A new session is created every time I get tokens from Keycloak.

Correct. This is the default behavior.

Every time I get a token, I want the previous sessions to be closed.

  1. Why not just reuse the token?
  2. There are Admin API methods to delete sessions. Look for " DELETE /admin/realms/{realm}/sessions/{session}" in Keycloak Admin REST API