How to get Keycloak users via REST without admin account

You need to assign the view-users role from the realm-management client, for the desired user. That would be the configuration for the user: Then you can grab all the users from the ${keycloakUri}/admin/realms/${keycloakRealm}/users endpoint. That’s the info retrieved from the enpoint, accesed via Postman: Also, unrelated to the asked question, I strongly encourage you not … Read more

keycloak Invalid parameter: redirect_uri

What worked for me was adding wildchar ‘*’. Although for production builds, I am going to be more specific with the value of this field. But for dev purposes you can do this. Setting available under, keycloak admin console -> Realm_Name -> Cients -> Client_Name. EDIT: DO NOT DO THIS IN PRODUCTION. Doing so creates … Read more

KeyCloak Server Caused by: java.lang.ClassNotFoundException: java.security.acl.Group

After some research I found the answer to my problem. The problem is that java.security.acl.Group is being deprecated since JRE 9 and marked for removal in future versions. java.security.acl.Group is being replaced by java.security.Policy I was running my Spring-Boot application on JRE 14 in which this class appeared to be no longer available. So once … Read more

How to specify refresh tokens lifespan in Keycloak

As pointed out in the comments by @Kuba Šimonovský the accepted answer is missing other important factors: Actually, it is much much much more complicated. TL;DR One can infer that the refresh token lifespan will be equal to the smallest value among (SSO Session Idle, Client Session Idle, SSO Session Max, and Client Session Max). … Read more

How to create a Script Mapper in Keycloak?

The magic of Script Mappers can be understood by looking at the keycloak sources here: Source The script can return something by using the exports variable like this exports = “Claim Value” The different types: user: Source JavaDoc realm: Source JavaDoc token: Source JavaDoc userSession: Source JavaDoc keycloakSession: Source JavaDoc Here is an example script: … Read more