Auth0 Hooks
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.
Whether Hooks can be used with connections varies according to extensibility point. Hooks that can be used with connections only work with Database Connections and Passwordless Connections.
Manage hooks
You can create, update, delete, enable/disable, and view Hooks from the Dashboard or Management API. To learn more, see:
Hooks may also be imported and exported using the Deploy Command-Line Interface (CLI) Tool.
Handle Rate Limits when calling APIs from within Hooks
If you call Auth0 APIs from within a Hook's script, you will need to handle rate limits. To do so, check the X-RateLimit-Remaining
header and act appropriately when the number returned nears 0.
Additionally, add logic to handle cases in which you exceed the provided rate limits and receive the 429
HTTP Status Code (Too Many Requests
). In this case, if a re-try is needed, it is best to allow for a back-off to avoid going into an infinite retry loop.
Manage hook secrets
Hooks feature integrated secret management to securely store secrets while making them conveniently available in code. To learn more, see Hook Secrets.
Test hooks
The Hooks editor in the Dashboard has an integrated Runner, which allows you to test your code without leaving the editor.
View logs
You can view real-time logging information for specific configured Hooks using the Dashboard. To learn more, see View Logs for Hooks.