Hi,
@magnificent-energy-493 suggested that I should use Ory actions/hooks and not the admin api. So i went into this and tried but it just does not work for me. I need to create a pre or post registration hook to create a user in my own database and use the userId as a trait in the kratos identity. Creating this user before proceeding with the registration should be the better approach but i do not get any error messages when doing that, so i am trying it with the after hook.
My kratos yaml flow for registration looks like:
registration:
lifespan: 10m
ui_url:
http://127.0.0.1:4455/registration
after:
password:
hooks:
- hook: web_hook
config:
url:
http://host.docker.internal:8080/v1/auth/signup
method: POST
body:
file:///etc/config/kratos/hooks/pre-registration.jsonnet
can_interrupt: true
And the jsonnet file is just
function(ctx) {
traits:{
email: ctx.identity.traits.email,
firstname: …,
},
}
So i get the error like error while parsing webhook response: got no validation errors.
The endpoint actually should return an userId, which it does if i use postman. Is there anything i need to include in the response?