Rules and Hooks. Which gets precedence?

I am trying to clear up a little confusion I have regarding rules and hooks. For instance, if I have a rule configured to run on account creation, but I also have a pre and post user registration hook defined will the hook take precedence over the rule?

If the rule runs every time then it would makes sense to just use the rule. I was trying to leverage hooks at first, but they don’t work with social logins which caused me to incorrectly assume that hooks worked with database logins and rules worked with social logins.

I tried a google search, but I couldn’t find anything authoritative.

Hi @robertz,

I apologize for the delay in response and would like to try and provide an answer for future users who have a similar question.

Pre and post registration hooks run asynchronously, but are triggered before a rule. To visualize I can link you to this document:

Rules are going to run during every authentication and hooks are only going to run during their specific event, before or after registration or during a client credentials grant, depending on the type of hook you have set up.

Thanks,
Dan

4 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.