Keycloak v.18: How to manipulate with users using Keycloak API

This step is overview.
enter image description here

1 Find master access token URL
enter image description here
enter image description here

In my demo URL,

http://localhost:8180/auth/realms/master/protocol/openid-connect/token

This may help long life of access-token time if you needs to more space time to handle step 3 and 4
enter image description here

2 Get master token
run postman, use #1-4 URL
assign variable in tests tab
enter image description here

access-token variable will be use #3 and #4

var jsonData = JSON.parse(responseBody);
postman.setEnvironmentVariable("access-token", jsonData.access_token);

set the Key in Body tab with x-www-form-urlencoded option
Click Send button
enter image description here

Should be return OK 200 status and see the access token
enter image description here

3 Get space-realm user
I added one user, I will get this user information
enter image description here
In my get user list URL

http://localhost:8180/auth/admin/realms/space-realm/users

Use this variable in Authorization Tab

{{access-token}}

enter image description here

4 Update user properties with 3’s user UI
set header
enter image description here

The status should be 204 No Content status
enter image description here

if get user information by id, get this result
with changed properties.
enter image description here

Leave a Comment