如何使用 REST API 在 keycloak 中重置用户密码 [英] How to reset user password in keycloak using REST API

查看:35
本文介绍了如何使用 REST API 在 keycloak 中重置用户密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想对我的 Keycloak 服务器进行休息调用.

根据文档应该很容易:

标题是默认的:

解决方案

要访问 Admin Rest API,您需要将 admin 令牌传递给 REST CALLS:

打开

您可以将上面获取的令牌传递给带有授权标头的 REST API.

请参阅 我的其他 SO 帖子,了解执行此操作的分步指南.

I want to make a rest call to my Keycloak server.

According to doc it should be easy: https://www.keycloak.org/docs-api/10.0/rest-api/index.html#_executeactionsemail

So before I'll start codeing I want to prepare Postman call, so my url is

http://localhost:8080/auth/admin/realms/test/users/12345/execute-actions-email

in raw body I'm providing ['UPDATE_PASSWORD']

and what I get is 401 Unauthorized and I can't get what I'm doing wrong?

Body:

Headers are default:

解决方案

For accessing the Admin Rest API you need to pass on the admin token to REST CALLS:

You would have been prompted to create an admin account as soon as you would have opened {keycloak-url}/auth.

You can use this admin account to obtain the admin token as shown below.

Note that only change you have to do in below call is your keycloak server address and value of admin username and password.

You can pass the token obtain above on to the REST aPIs with Authroization header.

Please refer to my other SO post for a step by step guide to do this.

这篇关于如何使用 REST API 在 keycloak 中重置用户密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆