Many answer above are correct but same time convoluted with other aspects of authN/authZ. What actually resolves the exception in question is this line:
services.AddScheme<YourAuthenticationOptions, YourAuthenticationHandler>(YourAuthenticationSchemeName, options =>
{
options.YourProperty = yourValue;
})