wooden-cartoon-49455
07/04/2025, 10:57 AMid_token
or similar) and store it in identity.metadata_public
or metadata_admin
.
• This is necessary to validate or audit which account was linked and to prevent multiple unrelated emails being linked (e.g., <mailto:testMain@gmail.com|testMain@gmail.com>
+ <mailto:testOther@gmail.com|testOther@gmail.com>
).
What we've tried:
• Using a Jsonnet mapper: seems to only apply during initial registration, not during linking or login. -> gh issue https://github.com/ory/kratos/issues/2898
• Using post-settings and post-login webhooks: they do not include OIDC claims or identifiers of the newly linked provider.
❗Is there any way — via Jsonnet, webhook, or something else — to get the new OIDC email (from id_token
) during linking, and store or validate it?
We’re open to any workaround or best practice — even fetching claims via Admin API if that's required.
Thanks in advance!wooden-cartoon-49455
07/04/2025, 12:03 PM<mailto:testMain@gmail.com|testMain@gmail.com>
and <mailto:testOther@gmail.com|testOther@gmail.com>
) to the same Kratos identity, unlinking one of them via the settings flow results in a 500 Internal Server Error from Kratos.
This seems to happen when Kratos cannot resolve which OIDC credential to remove or due to inconsistency in internal statebland-eye-99092
07/07/2025, 9:03 AMsub
claim, to uniquely identify the external account.
if a user links multiple OIDC accounts with different emailsCould you expand on how this would happen in your setup? Once a user has linked an account at a defined OIDC provider to a Kratos identity, Kratos normally doesn't allow linking another account at the same provider. So I wonder if this might be the root cause?
wooden-cartoon-49455
07/07/2025, 9:11 AM500 Internal Server Error
.
We've confirmed this is due to Kratos not being able to resolve which credential to unlink internally (or trying to unlink the wrong one)wooden-cartoon-49455
07/07/2025, 9:14 AMpublic.identity_credentials.config
{
"providers": [
{
"subject": "115953378442588631813",
"provider": "google-external",
"initial_id_token": "someToken",
"initial_access_token": "someToken",
"initial_refresh_token": ""
},
{
"subject": "102606360791501818151",
"provider": "google-external",
"initial_id_token": "someToken",
"initial_access_token": "someToken",
"initial_refresh_token": ""
}
]
}
wooden-cartoon-49455
07/07/2025, 9:27 AMbland-eye-99092
07/07/2025, 9:30 AMlink
nodes for providers that are already linked. Did you build your own UI here, that just calls the API with the provider if the user clicks on the button?wooden-cartoon-49455
07/07/2025, 9:31 AMwooden-cartoon-49455
07/07/2025, 9:34 AMwooden-cartoon-49455
07/07/2025, 9:34 AMlink
node is persists all the time.
But if we do: login flow first -> the settings will not give us link node for this provider (like you mentioned, since it's already linked)bland-eye-99092
07/07/2025, 9:38 AMBut if we do: login flow first -> the settings will not give us link node for this provider (like you mentioned, since it's already linked)Yea that's the intended flow. I am not sure what's happening during your login flow, but I would recommend that in your settings flow implementation you make sure that the user can't link the same provider again.
wooden-cartoon-49455
07/07/2025, 9:44 AM