Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"after registration" hook is not fired #361

Open
5 tasks done
olofholmlund opened this issue Nov 23, 2023 · 2 comments
Open
5 tasks done

"after registration" hook is not fired #361

olofholmlund opened this issue Nov 23, 2023 · 2 comments
Labels
bug Something is not working.

Comments

@olofholmlund
Copy link

Preflight checklist

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

  1. Create a project using custom UI (with ory elements/javascript sdk)
  2. Add "after registration" hook to ping some URL
Skärmavbild 2023-11-23 kl  10 42 31
  1. 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

@olofholmlund olofholmlund added the bug Something is not working. label Nov 23, 2023
@st3w4r
Copy link

st3w4r commented Mar 28, 2024

Hi, I'm facing the same issue.

No webhook in the list of events is being delivered:
image

When disabling the Enable sign in after registration it indeed works.
image

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:

image

So I had to create two webhooks with the similar settings, one triggered on Password and the other on OIDC:
image

That is working as expected:
image

@vinckr
Copy link
Member

vinckr commented Mar 28, 2024

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
Screenshot 2024-03-27 at 13 34 00

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working.
Projects
None yet
Development

No branches or pull requests

4 participants