What's the difference between Rules and Hooks and when to use them?

Question: What’s the difference between Rules and Hooks and when to use them?

Answer:

  • Rules

    • JavaScript functions that execute when a user authenticates to your application. They run once the authentication process is complete, and you can use them to customize and extend Auth0’s capabilities
    • Rules can be used in multiple ways enhancing your authentication and authorisation experience. Here’s the list of cases for which you can use them: LINK
  • Hooks (Beta)

    • Hooks are secure, self-contained functions that allow you to customize the behavior of Auth0 when executed for selected extensibility points of the Auth0 platform. Auth0 invokes Hooks during runtime to execute your custom Node.js code.
    • Example usage can be found here: LINK

Main difference is that rules are used for adding granularity to your login / signup experience while hooks are used for adding totally new mechanism to Auth0 extensibility points like:

  • Pre User Registration
  • Post User Registration
  • etc…

Supporting Documentation