2

I am trying to update my password via keycloak account management using postman and I get this error:

"error": "RESTEASY003650: No resource method found for POST, return 405 with Allow header"

My endpoint: http://keycloak_url/auth/realms/{realm name}/account//credentials/password/ I have done a post request

enter image description here

Valentin Vignal
  • 6,151
  • 2
  • 33
  • 73

2 Answers2

4

Password reset functionality via API is removed from keycloak(12+) as it was unsafe. You can refer this thread from github. You won't find /credentials/password/ api if you are using keycloak 12 or above.

Alternative that I can suggest is that use Application Initiated Action (AIA) or use Admin Rest API

You can see further these got removed from keycloak here.

References : https://github.com/keycloak/keycloak/pull/7393#issuecomment-773502862

Abhijeet
  • 4,069
  • 1
  • 22
  • 38
  • as @Abhiijeet said api method is removed. but you cann still redirect your user to update-password required action. – user1519979 Oct 23 '21 at 18:33
  • But the problem is update password ui doesn't take current password from user for a logged in user, and updating password without verifying current password seems unsafe. – Anwar Reefat Apr 20 '22 at 06:40
0

I am under keycloak 17+, I also had troubles to make it work, The correct url to use should be like:

https://myHost.com/auth/admin/realms/myRealm/users/99999999-9999-9999-9999-999999999999/reset-password

You absolutely need the /auth/admin/realms keywords (some other endpoints only use /auth/realms) !

You will also need an access token from either a keycloak user or a keycloak client in the Authorization header. Check somewhere else to see how to generate and use an access token.

The body should be like:

{
    "type": "password",
    "temporary": true,
    "value": "myNew-password1"
}

Check documentation:

https://www.keycloak.org/docs-api/17.0/rest-api/index.html#:~:text=Set%20up%20a%20new%20password%20for%20the%20user.

Geoffrey
  • 69
  • 1
  • 2
  • 5