Hey folks, a question to do with Usernames, Hooks ...
# talk-kratos
e
Hey folks, a question to do with Usernames, Hooks and Identity Schemas We want users to be able to have a unique username such as
allen
similar to other social media with handles like twitter or instagram In our use case, it would be important to search users by their username/handle so they can add each other It would be great to have username in our identity schema so users can login with their username & manage it through Kratos' self-service If we have username as a part of Ory Kratos & our identity schema, we have less control in some parts of our app Currently in our app's tables/schema we base many primary keys off a user's id (uuid) & the issue I have is that I'm not sure on how we can access the username for a user id unless we duplicate the username data to our own database since we don't have access to the crdb instance where our user data is saved on Ory Cloud If duplication is the best solution, it seems we will need to use hooks to keep duplicated data up to date -- please correct me if there's a better way In the case of duplicating the username to our own table called
profile
, I found the best solution would be to add a hook on
settings.after
leveraging the identity in the body given from
For the
after
execution path of all flows, it binds the
identity
object into the jsonnet template as well. These objects are available through a
ctx
object
https://www.ory.sh/docs/kratos/self-service/hooks#web-hooks My question is what jsonnet template do I need to pass the
id
,
traits.username
,
traits.email
and
traits.phone
as the body of the webhook & suggestions on where to host the template?
FWIW we use a Golang-based gRPC backend with a gRPC-gateway reverse proxy -- this will be where the webhook hits