在Keycloack上创建一个用户,包括curl命令中的密码 [英] Create a User on Keycloack including password from curl command

查看:185
本文介绍了在Keycloack上创建一个用户,包括curl命令中的密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用CURL命令在keycloak上创建一个用户(创建时不提供任何密码),该操作成功,但是无法知道登录密码. 因此,如何在创建时向用户提供密码. 以及如何在密钥斗篷中为新用户设置默认密码

I have tried to create a user(without giving any password while creating) on keycloak using CURL command, it's success, but not able to know the password to login. So, how to give password to a user while creating. and also how to set default password for new users in keycloak

我已使用此链接使用curl创建用户:在以下位置创建用户curl命令的密钥克隆

I have used this link to create a user using curl: Create user on Keycloack from curl command

推荐答案

您需要为用户设置credentials,以便您可以登录.
像这样

You need to set credentials for the user, so that you can login.
something like this

curl -v http://localhost:8080/auth/admin/realms/apiv2/users -H "Content-Type: application/json" -H "Authorization: bearer $TOKEN"   --data '{"firstName":"xyz","lastName":"xyz", "username":"xyz123","email":"demo2@gmail.com", "enabled":"true","credentials":[{"type":"password","value":"test123","temporary":false}]}'

您还可以使用bin目录中存在的cli命令来创建用户

You can also use cli command present in bin directory for creating users

add-user-keycloak.sh --user <USER_NAME> --password <PASSWORD>

这篇关于在Keycloack上创建一个用户,包括curl命令中的密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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