Defining a new user password through Keycloak REST API

浪尽此生 提交于 2021-01-29 12:10:02

问题


I am trying to create a new user via the REST API, and I'm sending this POST

POST /admin/realms/myrealm/users

Headers: Authorization: Bearer (generated token, this part is OK) Content-Type: application/json

Body:

{
    "username": "rahul",
    "enabled": true,
    "totp": false,
    "emailVerified": false,
    "firstName": "rahul",
    "lastName": "borse",
    "email": "rahulborse@yahoo.com",
    "credentials": [
        {
            "type": "password",
            "value": "rahul"
        }
    ]
}

The user is created normally, but the password doesn't work, when I try to login it claims I have invalid credentials.


回答1:


Try to add mapping "temporary": false to credentials:

{
    "username": "rahul",
    "enabled": true,
    "totp": false,
    "emailVerified": false,
    "firstName": "rahul",
    "lastName": "borse",
    "email": "rahulborse@yahoo.com",
    "credentials": [
        {
            "type": "password",
            "value": "rahul",
            "temporary": false
        }
    ]
}


来源:https://stackoverflow.com/questions/58321304/defining-a-new-user-password-through-keycloak-rest-api

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