[keycloak-user] Firstname and Lastname are null when REGISTER event

Jairo Henao jahenao at itroisolutions.com
Fri Aug 12 17:48:31 EDT 2016


Hello community:

I have a listener for REGISTER event and it works well, but when I try to get the first and last names of the user are null, but all other fields are filled as mail, telephone, etc.

@Override
       public void onEvent(Event event) {

              if (includedEvents.contains(event.getType())) {
            if (event.getRealmId() != null && event.getUserId() != null) {
                RealmModel realm = model.getRealm(event.getRealmId());
                UserModel user = session.users().getUserById(event.getUserId(), realm);

                if (user != null) {
                    if(isUserEnroledForClients(user, realm)){
                           //Cheking the event type
                           if(EventType.REGISTER.equals(event.getType())){
                                  //Sending the new data to hubspot
                                  log.infov("Registering the new user {0} in Hubspot...", user.getEmail());


                                  user.getEmail(); //IS FILLED
                                  user.getFirstName (); //IS NULL
                                  user.getLastName (); //IS NULL




After the registration process ends if I check the table, the new user has a firstName and lastName.




Jairo Henao Rojas
IT ROI Solutions

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20160812/1a3f4e1b/attachment-0001.html 


More information about the keycloak-user mailing list