<@U04UQ68083H> If I defined in kratos' configurati...
# ory-copilot
f
@chilly-king-10285 If I defined in kratos' configuration that for the registration flow there are after hooks for password and oidc, and a general hook (defined in field hooks), and a user try to register through password. Will the hook defined for password and the general hook be called?
b
A message from kapa.ai
No, if you define both a general (global) after hook (in the hooks field) and a method-specific after hook (e.g., under password) for the registration flow, only the method-specific hook(s) will be executed when that method is used. The method-specific configuration overrides the general hooks for that authentication method. So, if a user registers using the password method, only the hooks defined under after > password will be called, and the general after > hooks will be ignored for that flow. This is explicitly described in the documentation: > When an authentication method specifies actions, it overrides the default actions for the flow. > ... > With the following configuration,
hook_3
is executed when the user logs in with a password,
hook_2
is executed when the user logs in with any other method... >
Copy code
yaml > selfservice:   >   flows:   >     login:   >       after:   >         hooks:   >           - hook: hook_2   >         password:   >           hooks:   >             - hook: hook_3   >
> [Docs: Trigger precedence](https://www.ory.sh/docs/kratos/hooks/configure-hooks#trigger-precedence) This behavior is also confirmed in community discussions and issue comments, where it is noted that method-specific hooks override the global ones for that method, and only the method-specific hooks will be triggered for that authentication method [Webhook not working for registration with
code
method](https://github.com/ory/network/issues/346).