diff --git a/src/Umbraco.Web.BackOffice/Security/BackOfficeAuthenticationBuilder.cs b/src/Umbraco.Web.BackOffice/Security/BackOfficeAuthenticationBuilder.cs index 27b763218e..dd360b04f6 100644 --- a/src/Umbraco.Web.BackOffice/Security/BackOfficeAuthenticationBuilder.cs +++ b/src/Umbraco.Web.BackOffice/Security/BackOfficeAuthenticationBuilder.cs @@ -42,10 +42,17 @@ namespace Umbraco.Cms.Web.BackOffice.Security // add our login provider to the container along with a custom options configuration Services.Configure(authenticationScheme, _loginProviderOptions); - Services.AddSingleton(x => new BackOfficeExternalLoginProvider( - displayName, - authenticationScheme, - x.GetRequiredService>())); + base.Services.AddSingleton(x => + { + // need to create a scope to resolve IOptionsSnapshot + using (x.CreateScope()) + { + return new BackOfficeExternalLoginProvider( + displayName, + authenticationScheme, + x.GetRequiredService>()); + } + }); Services.TryAddEnumerable(ServiceDescriptor.Singleton, EnsureBackOfficeScheme>()); return base.AddRemoteScheme(authenticationScheme, displayName, configureOptions);