Cynical Developer
06/28/2024, 2:00 PMCannot insert duplicate key row in object 'dbo.umbracoExternalLogin' with unique index 'IX_umbracoExternalLogin_LoginProvider'. The duplicate key value is (UmbracoMembers.OpenIdConnect, *{{insert memeber's guid here}}*). The statement has been terminated.
I need the system to create different members for each social login, does anyone have any advice on how to do this, a link to a blog about it, or a link to documentation?
Thanks in advanced.D_Inventor
06/28/2024, 2:36 PMcsharp
authBuilder.SchemeForBackOffice(MyAuthenticationOptions.AuthenticationScheme)
If you have multiple login providers, you need to ensure that the authentication scheme that you provide here is unique for each providerD_Inventor
06/28/2024, 2:38 PMD_Inventor
06/28/2024, 2:39 PMCynical Developer
06/28/2024, 3:15 PMCynical Developer
06/28/2024, 6:37 PMOnAutoLinking = (autoLinkUser, externalLogin) =>
{
// You can customize the user before it's linked.
// i.e. Modify the user's groups based on the Claims returned
// in the externalLogin info
var providerSuffix = externalLogin.ProviderKey.Split('|')[0];
externalLogin.LoginProvider += $".{providerSuffix}";
}
This feels horrible but works a treat, and feels like its a future me problem to fix if it becomes an issue 😄D_Inventor
06/29/2024, 5:53 AMCynical Developer
06/29/2024, 6:40 PMD_Inventor
06/29/2024, 6:41 PMCynical Developer
06/29/2024, 6:44 PMDusten
04/27/2025, 11:39 AM