I am running custom registration and login forms (webAuth) and everything is working as expected, except that the “Name” field gets automatically assigned the user’s email address. I have attempted a few things so far to override the Name field, as I would like it to show their given name + last name instead. I have attempted using a post-registration hook, and putting the firstName and lastName (my app is written in javascript) field into user_metadata, and then trying to overwrite with user.name = user_metadata.firstName + ' ' + user_metadata.LastName
This unfortunately did not work. I also attempted it inside of a rule, with similar code to no success.
I should mention that it works in the little test/sandbox area of the post-register hook, adding the “name” field to the user object at the bottom and assigned it my desired values. However in production when I check my users, both in the GUI display their name shows up as their email address, as well as in the raw JSON.
I have a pre-register hook that is executing as desired so I believe I’ve configured this one correct, I am just prevented from adjusting the name.
I also tried the suggestion at the following link for how to override user.picture, as it was suggested that I should be able to do the same for name but it didn’t work either:
Take a look at this article about normalized user profiles. Particularly look at this line →
A user's `name` , `nickname` , and `picture` attributes are not directly editable, however you can update the fields in the `user_metadata` to update them for your front-end as desired.
Here is another document explaining why this is the case:
With that being said, I tested this rule and it will return the name field in the id token with the desired result.