Keycloak set required actions for user

902 Views Asked by At

How to set required actions for user through keycloak API? I haven't found it in their admin rest API documentation. There is only

PUT /{realm}/users/{id}/execute-actions-email

but it works through email which does not fit my requirements. I would like to force user to change their password on next login.

2

There are 2 best solutions below

3
mazda3301 On

So, next api solves my issue

Update the user
PUT /{realm}/users/{id}
0
Alexander Chadfield On

Keycloak 23.0.5 has 0 documentation and it is useless. Here is the answer I have found and worked for this version: request PUT {url}/admin/realms/{realm}/users/{id} request body: {"requiredActions":

["UPDATE_PASSWORD","CONFIGURE_TOTP","VERIFY_EMAIL"]

} This is the list of all actions you can use: enum RequiredAction { VERIFY_EMAIL, UPDATE_PROFILE, CONFIGURE_TOTP, UPDATE_PASSWORD, TERMS_AND_CONDITIONS }

Hope this will help someone and save some time.