Search code examples
spring-securitykeycloakspring-security-oauth2keycloak-services

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

I get the token in this way;

URL: http://keycloak_url/realms/{realm}/protocol/openid-connect/token

body

username:{username}
password:{password}
client_id:{client}
grant_type:password

Solution

  • The problem was fixed by adding the "User Session count limiter" step to the "direct grant" flow on the authentication page in the Keycloak interface.

    enter image description here