Change/Reset User Password

266 views
Skip to first unread message

Loukia Vasileiou

unread,
Oct 6, 2021, 3:15:21 AM10/6/21
to Keycloak User
Hello,

I would like to change (not temporarily) or reset logged in user's password from my angular application. My user is not admin. Is there any solution ? 

I tried the below requests but they need admin privileges:
  1. /auth/admin/realms/myrealm/users/id/reset-password/
  2. /auth/admin/realms/ myrealm  /users/id/execute-actions-email 

Narendra Kumar Challa

unread,
Oct 6, 2021, 3:17:45 AM10/6/21
to Loukia Vasileiou, Keycloak User
Hi Loukia,

This is expected as you are using ADMIN API. Please use the below, 
https://path-to-your-host.com/auth/realms/your-realm/account/credentials/password
Make sure you enabled account API.
Regards,
Narendra

--
You received this message because you are subscribed to the Google Groups "Keycloak User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to keycloak-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/keycloak-user/eb4bb73b-9c40-423b-a775-3c678145d9e0n%40googlegroups.com.
Message has been deleted
Message has been deleted
Message has been deleted

Saurav Mohan V

unread,
Oct 7, 2021, 10:46:34 AM10/7/21
to Keycloak User
Hi, 

Keycloak provides the Update Password Required Action just for this purpose.
As the "Update Password" Required Action is already an Application Initiated Action you can use the Keycloak angular package to initiate this required action on a button click or so.

calling the following on button click would do the trick.

this.keycloakService.login({
      redirectUri: window.location.href,
      action: 'UPDATE_PASSWORD',
  });

keycloakService is an instance of the Keycloak Service provided by the package.
Once the user is done resetting the password, they are redirected to the URL specified with redirectURI.

hope this helps. 

Regards,
Saurav Mohan V
Reply all
Reply to author
Forward
0 new messages