To get the domain, you have to go to the API section found under the applications tab on the Auth0 dashboard, and create a new API.
This will create the API and an application with Machine to Machine (M2M) type.
API created - Found in API section
Application created - Found in application section
Once done, you can access the application that was automatically created, copy the domain and paste it on the environment variables.
Management Client ID and Management Client Secret
By default, auth0 provides an api and an application called "Auth0 Management API". This will let you do all the things you're able to do on the dashboard, but with an API.
To use it, you have to get the keys and activate some permissions.
To get the keys, you have to enter to the "Auth0 Management API" found in the application section.
Auth0 Management API
There you will see the Client ID and the Client secret. Copy both and paste them in the environment variables.
Also, you will need to activate some permissions to use certain functionalities such as the "Send verification email" endpoint.
For that, you have to go to Applications > APIs section > Auth0 Management API > Machine To machine Applications > Auth0 Management API (Test Application), and activate the "update:users" permission:
Auth0 Management API Permissions
Management Audience
You can copy the Auth0 Management API audience in the APIs section.
Adding the email to the access token
When the users call the /auth/register endpoint, the API gets the user's email from the access token, and saves it to the database. But, by default, the email is not included on the Auth0 access token.
To add it, we need to create an Auth0 action flow. For that, you need to go to the Auth0 actions library and create one with the "Build Custom" button.
Auth0 Actions Dashboard
Once done, a modal should appear.
Fill every field like shown in the image:
Auth0 Action Modal
Open the custom action, paste this code and press deploy.
Replace the namespaces with your tenant.
Now you just need to add your custom action into a flow.
For that you need to go to the flows section and choose "Login".