I am checking the Keycloak documentation.
I am trying to figure out which endpoint should I use for deleting specific user from KeyCloak. I am using it within my Symfony project on REST Api..
Could someone clearfy that for me?
I am checking the Keycloak documentation.
I am trying to figure out which endpoint should I use for deleting specific user from KeyCloak. I am using it within my Symfony project on REST Api..
Could someone clearfy that for me?
First you need to get an access token from a user with admin-alike permission, for instance:
curl -d "client_id=admin-cli" \
-d "username=$ADMIN_NAME" \
-d "password=$ADMIN_PASSWORD" \
-d "grant_type=password" \
<YOUR_KEYCLOAK_DOMAIN>/auth/realms/master/protocol/openid-connect/token
From that response (i.e., a Keycloak Token Object), extract the access token. Then you need to use that access token, to call the following endpoints:
To delete a user you need to use the endpoint:
DELETE <YOUR_KEYCLOAK_DOMAIN>/auth/admin/realms/<YOUR_REALM>/users/{USER_ID}
to get the USER_ID
you can call the endpoint:
GET <YOUR_KEYCLOAK_DOMAIN>/auth/admin/realms/<YOUR_REALM>/users/?username=<THE_USERNAME>
or you can copy and paste from the Keycloak Admin Console, under the tab users: