[SOLVED] I've setup kratos via docker image and co...
# talk-kratos
b
[SOLVED] I've setup kratos via docker image and configured after registration webhooks. Currently I run in to the problem that after registration webhook is not executed. This is my current configuration. I do not get any exception from Kratos instances. Notice
ignore
is set as
false
What I'm missing here?
Copy code
dsn: memory

courier:
  smtp:
    connection_uri: <smtps://test:test@mailslurper:1025/?skip_ssl_verify=true>
  templates:
    recovery:
      invalid:
        email:
          body: {}
      valid:
        email:
          body: {}
    verification:
      invalid:
        email:
          body: {}
      valid:
        email:
          body: {}
identity:
  default_schema_id: default
  schemas:
    - id: default
      url: file:///etc/config/kratos/greener-account-schema.json

selfservice:
  allowed_return_urls: []
  default_browser_return_url: http:/127.0.0.1:3001/ui/welcome
  flows:
    error:
      ui_url: /ui/error
    login:
      after:
        hooks: []
        oidc:
          hooks: []
        password:
          hooks:
            - hook: require_verified_address
        webauthn:
          hooks: []
      before:
        hooks: []
      ui_url: http:/127.0.0.1:3001/auth/sign-in
    logout:
      after: {}
    recovery:
      after:
        hooks: []
      enabled: true
      ui_url: http:/127.0.0.1:3001/auth/recover-password
    registration:
      after:
        hooks:
          - hook: web_hook
            config:
              body: '<file://body.jsonnet>'
              method: POST
              response:
                ignore: false
              url: <http://127.0.0.1:3000/user/registration>
        oidc:
          hooks:
            - hook: session
        password:
          hooks:
            - hook: session
        webauthn:
          hooks: []
      before:
        hooks: []
      ui_url: http:/127.0.0.1:3001/auth/sign-up
    settings:
      after:
        default_browser_return_url: http:/127.0.0.1:3001
        hooks: []
        password:
          hooks: []
        profile:
          hooks: []
      privileged_session_max_age: 15m0s
      required_aal: highest_available
      ui_url: http:/127.0.0.1:3001/auth/reset-password
    verification:
      after:
        default_browser_return_url: <http://127.0.0.1:3001>
        hooks: []
      enabled: true
      ui_url: /ui/verification
  methods:
    link:
      config:
        base_url: ''
      enabled: true
    lookup_secret: {}
    oidc:
      config:
        providers: []
      enabled: false
    password:
      config: {}
    profile: {}
    totp:
      config:
        issuer: greener-dev
serve:
  admin:
    base_url: <http://locahost:4434/>
    request_log:
      disable_for_health: true
  public:
    base_url: <http://127.0.0.1:4433/>
    cors:
      debug: true
      enabled: true
      allowed_origins:
        - <http://localhost>
        - <http://localhost:3001/*>
        - <http://localhost:3001>
      allow_credentials: true
      allowed_methods:
        - POST
        - OPTIONS
        - GET
        - PUT
        - PATCH
        - DELETE
      allowed_headers:
        - Authorization
        - Cookie
        - Content-Type
      exposed_headers:
        - Content-Type
        - Set-Cookie
    request_log:
      disable_for_health: true
session:
  lifespan: 24h
  cookie:
    name: 'test_session'
    persistent: true
  whoami:
    required_aal: highest_available
This is my body.jsonnet file.
Copy code
function(ctx) {
    type: 'after_registration',
    user_id: ctx.identity.id,
    identity: ctx.identity,
    flow: ctx.flow,
}
Update: I tested the same hook before and after registration and only the before one was executed, the after one was ignored.
Update: I could successfully execute after registration web hook, the issue was the hook order, if it is declared after
hook: session
the web hook isn't executed. I do not remember to see this in the documentation. May this will useful to someone. 🙂
p
@wonderful-lamp-2357 maybe we can add this to the docs @billowy-hydrogen-91000 PRs are also welcome here 🙂