Hi I have a problem with send email to reset password. I using Keycloak 4.8. In documencation I found:
Send a update account email to the user An email contains a link the user can click to perform a set of required actions.
PUT /{realm}/users/{id}/execute-actions-email
And required params:
id
, realm
and actions
.
I write method using Guzzle:
$client = new \GuzzleHttp\Client();
$response = $client->request('put', 'https://myserwerkeycloak.com/auth/admin/realms/testrealm/users/a98e...00d1/execute-actions-email', [
'headers' => [
'User-Agent' => $_SERVER['HTTP_USER_AGENT'],
'Content-Type' => 'application/json',
'Accept' => 'application/json'
],
'form_params' => [
json_encode([
'actions' => ['UPDATE_PASSWORD'],
])
]
]);
$response
return 401 Unauthorized
So I added token:
'Authorization' => 'Bearer ' . $access_token,
No I have error 500:
local.ERROR: Server error:
PUT https://myserwerkeycloak.pl/auth/admin/realms/testrealm/users/a98e...00d1/execute-actions-email
resulted in a500 Internal Server Error
response {"exception":"[object] (GuzzleHttp\Exception\ServerException(code: 500): Server error:PUT https://myserwerkeycloak.pl/auth/admin/realms/testrealm/users/a98e...00d1/execute-actions-email
resulted in a500 Internal Server Error
response at C:\xampp\htdocs\project\project\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php:113)
But whe I wont generate $access_token
I need using email and password, so it's not good resolve because I click 'forgot password, send email...'
How I can used execute-actions-email
without authorization ?