Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reset user password in keycloak using REST API

I want to make a rest call to my Keycloak server.

According to doc it should be easy: https://www.keycloak.org/docs-api/10.0/rest-api/index.html#_executeactionsemail

So before I'll start codeing I want to prepare Postman call, so my url is

http://localhost:8080/auth/admin/realms/test/users/12345/execute-actions-email

in raw body I'm providing ['UPDATE_PASSWORD']

and what I get is 401 Unauthorized and I can't get what I'm doing wrong?

Body:

enter image description here

Headers are default:

enter image description here

like image 402
Piotr Żak Avatar asked Sep 13 '26 21:09

Piotr Żak


1 Answers

For accessing the Admin Rest API you need to pass on the admin token to REST CALLS:

You would have been prompted to create an admin account as soon as you would have opened {keycloak-url}/auth.

You can use this admin account to obtain the admin token as shown below.

Note that only change you have to do in below call is your keycloak server address and value of admin username and password.

enter image description here

You can pass the token obtain above on to the REST aPIs with Authroization header.

Please refer to my other SO post for a step by step guide to do this.

like image 65
tryingToLearn Avatar answered Sep 16 '26 10:09

tryingToLearn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!