silly-belgium-72317
01/31/2024, 4:23 PMctx
object for a registration flow) - identity should exist at that point in kratos, but from my tests user is not created and I get identity id = 00000000-0000-0000-0000-000000000000
. Is this a known bug? And if so how I can bind kratos user with my internal user entity after registration?careful-rain-13694
01/31/2024, 4:25 PMsilly-belgium-72317
01/31/2024, 4:26 PMsilly-belgium-72317
01/31/2024, 4:26 PMsilly-belgium-72317
01/31/2024, 4:26 PMsilly-belgium-72317
01/31/2024, 4:27 PMcareful-rain-13694
01/31/2024, 4:28 PMThe issue here is that because having theAnother option would be creating two different hooks as post-registration.set to true, it calls the webhook AFTER registration BEFORE creating it in the database, as the webhook response modifies the identity first. (feedback from Ory)response.parse
silly-belgium-72317
01/31/2024, 4:28 PMcareful-rain-13694
01/31/2024, 4:28 PMparse: false
for a post-registration action and used a post-login hook to ensure the account <> identityId mapping within our internal dbcareful-rain-13694
01/31/2024, 4:29 PMsilly-belgium-72317
01/31/2024, 4:29 PMsilly-belgium-72317
01/31/2024, 4:30 PMsilly-belgium-72317
01/31/2024, 4:30 PMcareful-rain-13694
01/31/2024, 4:31 PMcareful-rain-13694
01/31/2024, 4:31 PMcareful-rain-13694
01/31/2024, 4:32 PMparse
and ignore
parameters) it may help figuring out the right flow fitting your use-casesilly-belgium-72317
01/31/2024, 4:47 PMdazzling-napkin-4938
01/31/2024, 10:20 PMdazzling-napkin-4938
01/31/2024, 10:26 PMignore: false
parse: true
This webhook creates the member entity in our internal database, and updates Kratos’s metadata_public
to add our internal member.id to it, so now we can get our internal member from the kratos identity.
The second webhook is configured:
ignore: false
parse: false
At this stage the Kratos identity.id now exists, as the entity has been saved to the database (and kratos uses autogenerated IDs). The second webhook updates our member table with the kratos identity ID.
So now we have our internal ID stored on kratos’s identity.metadata_public, and we have the Kratos identity ID stored on our member tablesilly-belgium-72317
01/31/2024, 10:27 PMsilly-belgium-72317
01/31/2024, 10:27 PMdazzling-napkin-4938
01/31/2024, 10:28 PMregistration:
after:
hooks:
- hook: web_hook
config:
url: <http://example.com/create-member>
method: POST
body: <base64://YOUR> BASE 64 STRING
response:
ignore: false
parse: true
- hook: web_hook
config:
url: <http://example.com/update-kratos-id>
method: POST
body: YOUR BASE 64 BODY
response:
ignore: false
parse: false
silly-belgium-72317
01/31/2024, 10:29 PMsome-bear-63847
02/07/2024, 2:44 PMbumpy-sunset-99238
03/12/2024, 12:59 PMidentity.id
in a post-registration hook and do the provider-mapping inside our own application.