<@U04UQ68083H> how can i define in kratos' configu...
# ory-copilot
f
@chilly-king-10285 how can i define in kratos' configuration that for the registration flow there are 2 after hooks for password, session one and a custom hook?
b
A message from kapa.ai
To define two "after" hooks for the registration flow with the password method in Ory Kratos—one being the built-in session hook and the other a custom hook (such as a webhook)—you need to specify both hooks in the configuration under the password method, in the order you want them to execute. The order is important: the session hook should come after your custom hook, because once the session hook runs, it overrides any subsequent hooks in the flow. Here’s an example configuration in YAML:
Copy code
yaml selfservice:   flows:     registration:       after:         password:           hooks:             - hook: web_hook               config:                 url: <https://your-custom-webhook-endpoint>                 method: POST                 # ...other webhook config options...             - hook: session
- The first hook (
web_hook
) will trigger your custom logic (e.g., a webhook). - The second hook (
session
) will sign the user in after registration. Important: If you put the session hook before your custom hook, the custom hook will not be executed, as the session hook overrides subsequent hooks in the flow. This behavior is documented and confirmed in Ory’s documentation and community discussions [[Actions in Ory Identities](https://www.ory.sh/docs/kratos/hooks/configure-hooks#available-actions)] and [Ory Network issue #361](https://github.com/ory/network/issues/361). For more details and examples, see: - [Actions in Ory Identities](https://www.ory.sh/docs/kratos/hooks/configure-hooks#available-actions) - [Trigger precedence](https://www.ory.sh/docs/kratos/hooks/configure-hooks#trigger-precedence) - [Successful registration and session hook](https://www.ory.sh/docs/kratos/self-service/flows/user-registration#successful-registration) - [Ory Network issue #361](https://github.com/ory/network/issues/361)