Should we use a rule or a hook for inject custom claim into access token?


and

both show additions to the access token… which is the recommended path? using a rule or a hook to add a custom claim to the access token?

Hi @tommy.chheng thanks for reaching out to the Auth0 Community! :tada:

My suggestion would be to stick with Rules as they’re a bit more flexible but I’m not entirely sure of your use-case so I hesitate to advise too strongly. The Community Engineer Dan Woda has a great post about some of the functional differences between Rules and Hooks which might help you to determine where your code is best run.

If you can go into your use-case a bit more I may be able to point you in the right direction.

Best,
Colin

2 Likes

It sounds like using rules would be better here.

This is for adding claims for login not just registration(which seems hooks might be better for)

1 Like