通过Keycloak REST API定义新的用户密码 [英] Defining a new user password through Keycloak REST API

查看:363
本文介绍了通过Keycloak REST API定义新的用户密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过REST API创建一个新用户,并且正在发送此POST

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

POST/admin/realms/myrealm/users

标题: 授权:不记名(生成令牌,这部分可以) 内容类型:application/json

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

身体:

{
    "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.

推荐答案

尝试将映射"temporary": false添加到credentials:

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

这篇关于通过Keycloak REST API定义新的用户密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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