Provide Additional (transient) Fields to Registration VIA Webhook #4214
johnmarksilly
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I think this is an excellent idea and I've been building out a custom solution to solve this for my own use case, but seems like it would fit in nicely with other people's workflows.
Scenario
Passing additional data is super important to a registration flow with customers having dependent services that need keys. groups, or tags to be attached to a user on sign up.
It would be nice to provide end-users the ability to add these when they register.
Current Ability
To pass additional data, you must make use of the
transient_payload
field. Unfortunately with this field, you have to build out a custom UI with custom error logic that is cumbersome/hacky to work with.Workaround
My workaround to supplying dynamic fields is by using an external API in my self-service UI. When the flow is created, I forward that flow to an API which hydrates it with fields I need with special keys. The UI logic to display these fields works the same as Kratos so they display properly in forms. Just before a form is submitted, I bundle these fields up as part of the
transient_payload
and myafter
registration hook connects again to this external API to validate the additional properties. If there are any errors, I send this back to the UI.The problem with this solution is that the UI messages must be attached to real Kratos fields in order to propagate back to the UI. Ideally, I would pass arbitrary fields back from the web hook too, which will get rendered along with the Kratos form fields.
Idea
The
before
registration web hook should allow users to pass additional fields back to the UI (rather than just messages) or a new web hook entry point should be created to support this. Basically, every time the registration flow is updated, you make a call to this web hook to fetch additional fields and any messages to those fields.Beta Was this translation helpful? Give feedback.
All reactions