Keycloak send email reset password 401 Unauthorized or 500 Internal Server Error

∥☆過路亽.° 提交于 2019-12-24 19:03:58

问题


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 a 500 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 a 500 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 ?

来源:https://stackoverflow.com/questions/56221915/keycloak-send-email-reset-password-401-unauthorized-or-500-internal-server-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!