Create a User on Keycloack including password from curl command

青春壹個敷衍的年華 提交于 2021-01-21 07:29:12

问题


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

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


回答1:


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}]}'

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

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


来源:https://stackoverflow.com/questions/56526560/create-a-user-on-keycloack-including-password-from-curl-command

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