diff --git a/src/Umbraco.Web.BackOffice/Security/BackOfficeAuthenticationBuilder.cs b/src/Umbraco.Web.BackOffice/Security/BackOfficeAuthenticationBuilder.cs index dd360b04f6..633135b2a1 100644 --- a/src/Umbraco.Web.BackOffice/Security/BackOfficeAuthenticationBuilder.cs +++ b/src/Umbraco.Web.BackOffice/Security/BackOfficeAuthenticationBuilder.cs @@ -45,12 +45,12 @@ namespace Umbraco.Cms.Web.BackOffice.Security base.Services.AddSingleton(x => { // need to create a scope to resolve IOptionsSnapshot - using (x.CreateScope()) + using (IServiceScope serviceScope = x.CreateScope()) { return new BackOfficeExternalLoginProvider( displayName, authenticationScheme, - x.GetRequiredService>()); + serviceScope.ServiceProvider.GetRequiredService>()); } }); Services.TryAddEnumerable(ServiceDescriptor.Singleton, EnsureBackOfficeScheme>());