如何从 Keycloak 的 REST API 获取名字和姓氏?

How to get first name and last name from Keycloak's REST API?

我使用此 curl 命令获取令牌:

curl \
  -d "client_id=admin-cli" \
  -d "username=admin" \
  -d "password=admin_password" \
  -d "grant_type=password" \
  "https://example.com/auth/realms/master/protocol/openid-connect/token"

然后我使用此 curl 命令获取我的 Development 领域的用户列表:

  curl \
  -H "Authorization: bearer token" \
  "https://example.com/auth/admin/realms/Development/users"

它 returns 一个用户列表。这是示例用户的响应 JSON:

{
    "id": "9ca4216f-d13e-49f9-8c35-36e60916c6a9",
    "createdTimestamp": 1631337976997,
    "username": "admin@example.com",
    "enabled": true,
    "totp": false,
    "emailVerified": false,
    "email": "admin@example.com",
    "disableableCredentialTypes": [],
    "requiredActions": [],
    "notBefore": 0,
    "access": {
        "manageGroupMembership": true,
        "view": true,
        "mapRoles": true,
        "impersonate": true,
        "manage": true
    }
}

first namelast name 在哪里?我怎样才能得到这些数据?

它们不显示的最简单原因是这些属性不存在或未填充。您能否确认您知道该用户的名字和姓氏?