diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ExternalLoginRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ExternalLoginRepository.cs index e49e2ffda9..352b1dd3fd 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ExternalLoginRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ExternalLoginRepository.cs @@ -96,6 +96,9 @@ internal class ExternalLoginRepository : EntityRepositoryBase 0) { + // Before we can remove the external login, we must remove the external login tokens associated with that external login, + // otherwise we'll get foreign key constraint errors + Database.DeleteMany().Where(x => toDelete.Contains(x.ExternalLoginId)).Execute(); Database.DeleteMany().Where(x => toDelete.Contains(x.Id)).Execute(); }