Password reset request works via "Forgot Password" link but not via Admin REST call

Hello,

Like the title says, I am trying to have Keycloak send a password-reset email to users via the Admin REST endpoint /{realm}/users/{id}/execute-actions-email. I am getting a 204 No Content back so it’s not like I am sending incorrect content (I have also validated that the test user does have a valid email address). I have sent incomplete bits to make sure that part was working :sweat_smile:

The confusing part is that if I use the forgot password link in the UI’s login page and enter my email I get the reset email. The user I am connecting with REST has the admin role as well as pretty much all the realm-management privileges.

Has anyone else run into this? I am hoping that I am just missing something painfully obvious :confused:

Thanks in advance,
Sean

The 204 is expected in a successful response per keycloak/UserResource.java at main · keycloak/keycloak · GitHub

Can you send an example curl or other HTTP dump of your request? That will help debug.

Here is the logging from the call:

2022-08-25 11:49:57.140 DEBUG 70034 --- [nio-7015-exec-2] c.c.e.l.util.WebClientFilter      : logMethodAndUrl: PUT to https://host/auth/admin/realms/myRealm/users/userId/execute-actions-email?redirect_uri=http://localhost:1339&client_id=myclient
2022-08-25 11:49:57.979 DEBUG 70034 --- [ctor-http-nio-2] c.c.e.l.util.WebClientFilter      : logStatus: Returned status code 204 (No Content)

The request body is: ["UPDATE_PASSWORD"]

I can grab headers if you think that would help.

Nothing obvious. The fact that it’s returning a 204 seems from the code like it should be completing the send. Have you run a sniffer (e.g. Wireshark) to see if there is any SMTP i/o that’s happening?

no, that’s a good idea!