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

Before verification webhook not called #4110

Open
3 of 5 tasks
camero2734 opened this issue Sep 17, 2024 · 0 comments
Open
3 of 5 tasks

Before verification webhook not called #4110

camero2734 opened this issue Sep 17, 2024 · 0 comments
Labels
bug Something is not working.

Comments

@camero2734
Copy link

camero2734 commented Sep 17, 2024

Preflight checklist

Ory Network Project

Self-hosted

Describe the bug

I have set up a before verification web_hook, but it doesn't seem to be fired in most circumstances. It doesn't seem to be fired:

  • Upon initial registration
  • When I update settings to add a new email

In both situations, I receive the verification email -- once I verify my email, the after verification webhook is fired, but in neither case is the before fired.

The only situation in which it is fired is if I manually create a new verification (GET /self-service/verification/browser), but the expected behavior (for me at least) would be for it to be fired anytime a verification flow is created, even if it's implicitly as part of another flow.

Reproducing the bug

  1. Configure kratos with before verification hook
  2. Register an account
  3. The webhook will not be triggered

Relevant log output

No response

Relevant configuration

selfservice:
  flows:
    verification:
      use: code
      enabled: true
      ui_url: https://localhost:8080/ui
      lifespan: 30m
      before:
        hooks:
          - hook: web_hook
            config:
              url: http://localhost:3000/before_verification
              method: POST
              body: file:///before_verification.jsonnet # this just returns { ctx: ctx }

Version

1.2.0

On which operating system are you observing this issue?

None

In which environment are you deploying?

Docker Compose

Additional Context

I was able to get the desired behavior by adding

if err := e.r.VerificationExecutor().PreVerificationHook(w, r, verificationFlow); err != nil {
  return err
}

before CreateVerificationFlow in selfservice/hook/verification.go. Happy to put up a PR if this is indeed the desired behavior for Kratos.

@camero2734 camero2734 added the bug Something is not working. label Sep 17, 2024
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

1 participant