As you know, Auth0 does not provide a convenient way to map user attributes for social logins. So, we need to write a script for Actions to map them.
On the other hand, some of the social IdP providers, such as Apple, give first_name and last_name attributes, which are incompatible with OIDC Standard attributes (Standard is given_name and family_name).
So I tried to write a script for Pre-User Registration Actions, but the API object does not allow me to change user given_name and family_name attributes.
I also tried Login / Post Login Actions, and it’s the same. API object only has setAppMetadata and setUserMetadata, which are not the correct methods for updating the user’s given_name and family_name attributes.
At this point, what exactly can I do for this very basic but complicated process?
You could consider setting Apple connection as a custom social Identity Provider connection to provide fields mapping.
The place to go would be Auth0 dashboard → Authentication → Social → Create connection → Create Custom.
This article describes it.
While setting this up you would provide fields mapping within the Fetch User Profile script.
The Fetch User Profile script perform a call to the IdP to fetch user profile data.
If you decide to go with that, you can also find additional support by searching this community for topics like “Fetch user profile script”, “custom social connection”, “Custom IdP” and similar.
From my side, I would like to also let you know that to interact with the Auth0’s Management API (to update user profile data like given_name or family_name) you could use within this Action our “auth0” library instead of writing your own function.