Setting a user's name when they are accepting an invitation for an organization

Hello,

I asked a question earlier around a user’s name not being set when they accept an invitation to an organization: Invited users do not have their names populated after they accept an invitation

Our main objective is to set the name and subsequently have the default picture generated by Auth0 to use the correct initials vs using the email.

I started by adding the name to the user_metadata when creating an invitation, which seems to be accessible using the event.user.user_metadata object in the action. The idea was to then setup an action to read this name from the metadata and set the user’s name using the management api client. I figured that the pre-registration hook is the best place for this task but after looking at the documentation for the event object, the auth0 user ID is not available since the user has not been created: Actions Triggers: pre-user-registration - Event Object this means that we can’t use the management client to update the user as suggested in the previous post.

I then tried to edit a current users name through the UI to see if a new picture would be generated, but that does not happen either. This means that using the post-registration flow won’t work since the user has already been created and updating the name there won’t change the previously generated picture.

Is there something I’m missing to set a user’s name if they are invited to an organization? Thanks for any help in advance!

Hi @youssef.elkhalili

Thanks for getting in touch with us at Auth0 Community.

My understanding is a post login action will execute when a user accepts an invitation for an organization. Perhaps you could update the name, picture properties this way?

Warm regards.

Thanks for the reply

I don’t want to update the picture manually. I want to make sure that when Auth0 creates the default picture, it uses the name of the user vs the email of the user. Will this be accomplished using the post-login action or will the avatar be already generated at that point?

Hi @youssef.elkhalili

I did some testing on this and the picture always appears to use the email address as a source. I did locate an internal task on improving how this works but there is no ETA yet on this. I would suggest you add some feedback here about your use case.

Let me know if you need anything further.

Warm regards

Hello @SaqibHussain

Just wanted to point out that if I create a user through the management API, and set a name the picture is generated using the name and not the email:

Example:

This is the desired behaviour we are looking for but if it’s not possible through an invitation or a custom action then I will just leave feedback like you mentioned.

Thanks.

1 Like

Hi @youssef.elkhalili

Yes that is the behaviour I would have expected, the issue is that by the time the post user registration action executes the user has already been created so there is no opportunity to control the name of the user on creation which would have solved your issue I guess on the invitation flow.

Yes please log the feedback request to highlight this to our product teams.

Warm regards.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.