Assigning a Default Role to Users on Sign-Up with Auth0 Actions

Auth0 Actions allow you to customize your registration flows to fit your needs. Let’s learn how to add a default role to a user when they sign up to your application.
Read more…

:writing_hand:t2: Brought to you by @carlastabile

I think there is an error with this tutorial. At the top of the example, you check if the user doesn’t have a role assigned yet doing if (event.authorization && event.authorization.roles && event.authorization.roles.length === 0) but this check if the user DOES have a role so the function does the opposite of what you want.
Instead, you should do something like if (event.authorization?.roles?.length) return;

Also this may help to all that are new to this topic and run into a error looking like this:

Grant type 'client_credentials' not allowed for the client.

This is the answer:
How can I use the Management API in Actions? - Auth0 Community