Using registration after
hooks to create user within our service
#3477
-
For the Registration after hooks (Docs) the documented usecase below doesn't appear to be possible:
The identity response in the hook doesn't contain key information, instead it just contains placeholder data, such as no identity ID etc, and so there isn't a way to be able to properly associate the Kratos Identity with our account service. Is this intentional, or should I raise as a bug? This is the response from a successful registration after hook. {
"identity": {
"created_at": "0001-01-01T00:00:00Z",
"id": "00000000-0000-0000-0000-000000000000",
"metadata_public": null,
"recovery_addresses": [
{
"created_at": "0001-01-01T00:00:00Z",
"id": "00000000-0000-0000-0000-000000000000",
"updated_at": "0001-01-01T00:00:00Z",
"value": "<snip>",
"via": "email"
}
],
"schema_id": "default",
"schema_url": "",
"state": "active",
"state_changed_at": "2023-09-04T16:37:50.561876646Z",
"traits": {
"email": "<snip>"
},
"updated_at": "0001-01-01T00:00:00Z",
"verifiable_addresses": [
{
"created_at": "0001-01-01T00:00:00Z",
"id": "00000000-0000-0000-0000-000000000000",
"status": "pending",
"updated_at": "0001-01-01T00:00:00Z",
"value": "<snip>",
"verified": false,
"via": "email"
}
]
}
} What's the recommended way of using these hooks for being able to associate an new identity with our internal account service? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Looking through the Kratos code, there appears to be two internal hooks
|
Beta Was this translation helpful? Give feedback.
-
Solved by Krzysztof` on Slack. Sharing the response here incase anyone comes across this discussion. I believe this is controlled by the response:
parse: false configuration option. Disallowing webhook response from modifying the identity should let it run after persist phase. |
Beta Was this translation helpful? Give feedback.
-
A heads up to anyone else who is integrating this. The "global" level hooks are only run if there are no flow specific hooks of any type (not just webhooks). In my case because the code/password, etc flows had the -session hook, I also needed to duplicate the webhook definition to each of those. |
Beta Was this translation helpful? Give feedback.
Solved by Krzysztof` on Slack. Sharing the response here incase anyone comes across this discussion.
I believe this is controlled by the
configuration option. Disallowing webhook response from modifying the identity should let it run after persist phase.