Attempting to setSingleAttribute with custom registration

Hi,

Ive taken the following code as the basis for a custom registration module (keycloak/RegistrationUserCreation.java at main · keycloak/keycloak · GitHub) and have amended as follows;

        user.setEnabled(true);

        context.setUser(user);
        user.setSingleAttribute("bespoke", "value");
        context.getAuthenticationSession().setClientNote(OIDCLoginProtocol.LOGIN_HINT_PARAM, username);

What I’m trying achieve is to set a user attribute “bespoke” - the code seems to run ok, but when I check the user’s attributes nothing has been populated.

Any ideas what am I missing?

Hi @tropas2001 , I have your same issue on a keycloak 16.1.1

I’m trying to use this spi.
The code runs without errors but Keycloak doesn’t save the user attribute on the user profile.

Have you resolved your issue?