Implement Custom Actions Using Pre-User Registration Extensibility PointsBeta
For Database Connections, the Pre-User Registration extensibility point allows you to add custom data points to a newly-created user's profile.
This allows you to implement scenarios such as setting conditional information (in the form of metadata on users that do not exist yet.
Starter code and parameters
After you've created a new Hook that uses the Pre-User Registration extensibility point, open up the Hook and edit it using the Webtask Editor embedded in the Dashboard.
The parameters listed in the comment at the top of the code indicate the Auth0 objects (and the parameters within the objects) that can be passed into and used by the Hook's function.
The callback function
cb at the end of the sample code is used to signal completion and must not be omitted.
The default response object every time the Hook runs is similar to the following:
If you specify
user_metadata in the response object, Auth0 adds this information to the new user.
Testing your Hook
Once you've modified the sample code with the specific scopes of additional claims you'd like added to your Access Tokens, test your Hook using the Runner. The runner simulates a call to the Hook with the appropriate user information body/payload. The following is the sample body that populates the Runner by default (these are the same objects/parameters detailed in the comment at the top of the sample Hook code):
Example: Add metadata to new users
Using the test runner, we see that the response, reflecting the updated metadata, is as follows: