Problems using declarative user profile

Hi everyone,

I am trying to use the new declarative user profile as per the documentation

Specifically, I enabled it with

-Dkeycloak.profile.feature.declarative_user_profile=enabled

and set it to default in the keycloak console

/subsystem=keycloak-server/spi=userProfile:add(default-provider=declarative-user-profile)

However, going to the user profile page gives me an empty list and and several errors in the javascript console:

 TypeError: $scope.currentAttribute is undefined
    <anonymous> realm.js:1519
    Angular 5
angular.js:15635:15
    Angular 7
TypeError: attribute is undefined
    handlePermission realm.js:1527
    <anonymous> realm.js:1541
    Angular 5
angular.js:15635:15
TypeError: attribute is undefined
    handlePermission realm.js:1527
    <anonymous> realm.js:1545
    Angular 5
angular.js:15635:15
TypeError: attribute is undefined
    handlePermission realm.js:1527
    <anonymous> realm.js:1549
    Angular 5
angular.js:15635:15
TypeError: attribute is undefined
    handlePermission realm.js:1527
    <anonymous> realm.js:1553
    Angular 5
angular.js:15635:15

Trying to create and save an attribute does nothing, but throws another error in the console:

 TypeError: $scope.config.attributes is undefined
    save realm.js:1607
    link app.js:2732
    Angular 2
    link app.js:2725
    jQuery 2
angular.js:15635:15
    Angular 3
    link app.js:2725
    jQuery 2

I am using keycloak version 14.0.0 in a docker environment.

Am I doing something wrong, or is this a bug in keycloak?

Hello, got this issue too. Problem here is that you need to do two steps to activate this feature

  1. Provide flag
-Dkeycloak.profile.feature.declarative_user_profile=enabled
  1. Configure spi in jboss-cli
/subsystem=keycloak-server/spi=userProfile:add(default-provider=declarative-user-profile)

After step 2 you need to restart container, but when you restarting - state is deleting, so step 2 will no affect

To solve this issue you should manually update keycloak config (in my case standalone-ha.xml)
and add this part

              <spi name="userProfile">
                  <default-provider>declarative-user-profile</default-provider>
              </spi>

Againg, issue caused by restarting the container and not saving the state produced by step 2 so you should manually add it to the config. Hope this helps :slight_smile:

2 Likes

Yup, that fixed it. Thanks a lot! :smiley:

This happens with helm chart helm-charts/charts/keycloak at master · codecentric/helm-charts · GitHub version 14.01

Server info show declarative-user-profile as SPI provider for userProfile, but there is User Profile switch in realm settings.

User profile attributes can be created and edited, but registration form and user creation from admin console fail with missing field message.