Unable to add new user from admin console when user profile feature is enabled

Hi,
I’m using the preview feature user profile to dynamically manage the registration of my users on a realm. Basically, I need a couple of mandatory fields that users need to fill during registration. Those fields have been setup to be mandatory for both users and admins, without any scope.

The registration form works fine and I’m able to register new users with those new attributes.
Conversely, when it comes to adding new users from the admin console, those fields are not shown and the save user action ends up in an error, since those required fields have not been added.

What shall I do to allow the dynamic show of the user profile attributes in the admin console?
Thank you!

Keycloak instance running on docker, version 18.0.2

@riccardodelucia Were you able to figure out a solution for this?

Seems like it is a perfectly reasonable to create required attributes, force a user to add them on registration or update them on sign-in, but not require them on admin console user creation.

Or if they would need to be required regardless then there should be a way to have these shown on the admin console.

This is fixed in the newer version of the admin console, from version 20.x

1 Like

That’s strange since I have this error on 20.0.3. I have a custom attribute named dateOfBirth which is set to required for both admin and users but creating a user from the admin panel throws the error Please specify attribute dateOfBirth.

On adding a user the POST to http://localhost:8080/admin/realms/{REALM}/users fails with a 400 BAD REQUEST. Response JSON:

{
  "errorMessage" : "Please specify attribute dateOfBirth."
}

Also to note this is attributes added from the “User profile” tab for the realm.


oh sorry must have introduced that in an even later version, the create screen then looks like this


I’ve added a field called required

That is strange. I have updated to Keycloak version 20.0.5 and I cannot get this to show on the “Create User” screen.

Maybe I have something not set up correctly?

The required Date of Birth Attribute:

Create User page for this realm:

@edewit I see that this is working now after upgrading to Keycloak Version 21. Thank you for that.

However, after clearing out all configurations and starting from scratch on a new version 21 deploy I noticed that settings a realm to be email as username still shows both the Username and Email fields on “Create User”.

Is this expected? Is something missing?