Keycloak Upsert a Realm User
A 4-step recipe with Red Hat. We can help you get access.
Recipe · 4 steps
Keycloak Upsert a Realm User
with Red Hat · Identity & Access Management
Upsert a Keycloak realm user keyed on username.
- Search the realm for an exact username match, returning at most one user.
- Update the matched user's profile attributes in place.
- Create a new user in the realm with the supplied profile attributes when no existing user matched the username.
- Re-read the realm by username to resolve the id of the user that was just created, since the create call returns no body.
What you'll need to have ready
- token: Admin bearer token for the Keycloak admin API.
- realm: The realm the user belongs to.
- username: The username used to detect an existing user.
- email: The email address to set on the user.
- firstName: The user's first name.
- lastName: The user's last name.
- enabled: Whether the user account is enabled.
For your developer
Arazzo workflow red-hat:upsert-user, 4 operations: listUsers → updateUser → createUser → listUsers. Specs on APIs.io.