Can I use a post-user registration action (or hook) to update a user?

Question: Can I use a post-user registration action (or hook) to update a user?

Answer:

No. If you’d like to make changes to the user when they sign up, such as assign a role or add metadata, it’s best to use a pre-user-registration or post-login action instead.

The post-user registration action trigger is designed to notify another system that a user has registered for your application. Use this type of action to execute asynchronous tasks such as adding a user ID to an external system or sending a Slack notification.

Here are a couple of things to keep in mind when considering this type of action or hook:

  • The post user registration action will only run for Passwordless or Database users. This action will not execute when users from other types of connections log in to your app for the first time. For example, the action will not run when a user logs in with a social connection such as Google.
  • It’s recommended not to use the post user registration action for making changes to the user. For example, it’d be best not to use a post-user registration action for assigning roles or updating user metadata, as the user may not be available when the action runs. For tasks that involve modifying the user in Auth0, you can use a pre-user registration or post-login action instead.

Supporting documentation:

1 Like