How to automatically populate given_name and family_name on user signup/login?

Hello! We are using Auth0 as an IdP for SSO to Thinkific (https://www.thinkific.com/) using OpenID Connect. Thinkific requires the root attributes given_name and family_name to be set on the user.

We use the Universal Login Classic Experience. When the user logs in using Google, these attributes are properly set and it works just fine. However, when the user logs in using GitHub or email/password, these attributes are not set and the login fails.

Is there a way to ensure that these root attributes are always set for users when they sign up, even with dummy values (we don’t actually need their names)? I looked into using the pre-user-registration action trigger, but it seems that the API object there only allows editing user_metadata and app_metadata, but not root attributes like given_name and family_name.

I also found this page in the docs: Set Root Attributes During User Signup
However, it seems that this page covers the case when we are creating the user manually and not when Universal Login Classic (which seems to use Auth0 Lock under the hood) initiates the user creation for us. In a similar fashion, I could use the Management API to update the user post-signup, but apparently that specific trigger is non-blocking, so I’m worried that by that point Auth0 would have already sent the user data to Thinkific with the attributes still missing.

I am currently looking into 2 potential solutions to update the user after they sign up / log in, but before their data is sent to Thinkific, which I’m not sure will pan out:

  • Using one of the blocking action triggers (maybe the post-login one?)
  • Customizing the Auth0 Lock configuration in the Universal Login Classic page

I would greatly appreciate some pointers, even just confirming/denying whether or not I’m on the right track would be helpful.

Thank you in advance!

1 Like

Hi @wandb-axel,

Welcome to the Auth0 Community and sorry for the late reply.

You should definitely be able to use a post-login action in your use case since this is triggered after a user is authenticated but before a token is issued. Since the user-metadata is only required to create the user’s account in Thinkific, you can use the api.user.setUserMetadata function and provide any value for the given_name and the family_name.

Additionally if those values would also have to be set up correctly, you can also use the Forms option provided by Auth0 that can request the user to enter their firstname and lastname even after a social connection is enabled and assign the specified fields to the user’s metadata, which will then have to be assigned to a post-login action as well. There are different predefined templates that you can use and more information can be checked under this documentation.

Thank you for your post and I hope this helped,
Remus

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