I know that Kratos does not have built-in support for automatic linking, but I need to implement a slightly similar feature.
I want it to be possible for administrators to create identities with a special flag set (perhaps as part of the identities metadata) and an e-mail.
Once a user registers via a social login with the same e-mail, I want to link that social login to the existing identity, provided it has the special flag set (which is then unset).
Is it possible to implement this using webhooks? I'd need to catch the sign up attempt and link the social login to the existing identity (without creating a new one).
I'm unsure how to get the necessary info for linking the social login to an existing account. One possibility I can think of is letting the user actually create a new identity and trigger an after-registration webhook that copies the social login link data to the existing identity, deleting the new one. Would that work?