"after registration" hook is not fired
Preflight checklist
- [X] I could not find a solution in the existing issues, docs, nor discussions.
- [X] I agree to follow this project's Code of Conduct.
- [X] I have read and am following this repository's Contribution Guidelines.
- [X] I have joined the Ory Community Slack.
- [X] I am signed up to the Ory Security Patch Newsletter.
Ory Network Project
recursing-dirac-6i4w187k0d
Describe the bug
We have configured an action to fire after registration but the webhook is never fired.
I have tried with a simple "ping" webhook which does nothing more than ping my API to eliminate issues with the hook itself. This is the only configured action in the project, so no actions that would interfere.
We are using custom UI with the javascript SDK and not the default account experience, but our users are successfully registered and shows up in the identities list.
If I in the console disable the option Enable sign in after registration then the webhook is fired
The option can be found at https://console.ory.sh/projects/current/authentication
By looking at the raw json config it seems that the automatically added session webhook interferes with the configured action.
Thanks
Reproducing the bug
-
Create a project using custom UI (with ory elements/javascript sdk)
-
Add "after registration" hook to ping some URL
-
Register a new user and the webhook is not fired.
(to fix)
4. disable Enable sign in after registration
5. Register new user, the webhook is now fired but user is not automatically signed in due to the option being disabled
Relevant log output
No response
Relevant configuration
No response
Version
Ory network (essential plan)
On which operating system are you observing this issue?
Ory Network
In which environment are you deploying?
Ory Network
Additional Context
No response
Hi, I'm facing the same issue.
No webhook in the list of events is being delivered:
When disabling the Enable sign in after registration it indeed works.
But this impact the user experience.
Enabling sign in after registration back.
It is working when method Password or OIDC are selected individually, if All is selected it does not work:
So I had to create two webhooks with the similar settings, one triggered on Password and the other on OIDC:
That is working as expected:
Hello @olofholmlund
This is caused by the session hook, see the docs here: https://www.ory.sh/docs/actions/session
The session hook overwrites any other hooks that run after it which is why you don't see a response. In Ory Console it is the "Sign in after registration" setting. That setting is actually a hook, the "session hook".
The solution would be to put the session hook after the other one.
So add the action to each auth method (oidc, password, webauthn) and then order it so the session hook comes last.
See this screenshot
To order the hooks, export the configuration through the Ory CLI
and order it like so
password:
hooks:
- config:
body: https://storage.googleapis.com/bac-gcs-production/bar.jsonnet
can_interrupt: false
method: POST
response:
ignore: false
parse: false
url: https://webhook.site/foo
hook: web_hook
- hook: session
Then the webhook should work as expected.
Apologies for the weird behaviour here, we are currently working on making this work as expected out of the box. At the moment I would recommend to use the Ory CLI to edit registration hooks instead of the UI.