Limit hooks to a specific application or API

Similar to Limit hook to specific applications

We are running M2M apps and wish to add some custom info to our JWTs through custom claims. Our extensibility point would be Client Credentials Exchange. We wish to implement this using Auth0 hooks however the documentation mentions:

The enabled Hook will be executed for all applications and APIs.

We have many apps running with different use cases and not all of them need hooks. Is there a workaround for this?

Hi @MyMirelHub

The client credentials hooked is invoked with the client as a parameter (among other things).
Just use an “if” to execute your code if the client ID is the correct one. Don’t forget to call the callback if the client ID is NOT the correct one as well.

John

2 Likes

Hey there!

As this topic is related to Rules - Hooks - Actions and Rules & Hooks are being deprecated soon I’m excited to let you know about our next Ask me Anything session in the Forum on Thursday, January 18 with the Rules, Hooks and Actions team on Rules & Hooks and why Actions matter! Submit your questions in the thread above and our esteemed product experts will provide written answers on January 18. Find out more about Rules & Hooks and why Actions matter! Can’t wait to see you there!

Learn more here!