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

1 Like