IDX20803:无法从多权限获取配置

IDX20803: Unable to obtain configuration from - Multiple Authority

首先,让我解释一下为什么我的问题与网站上已经围绕此错误提出的其他问题不同。知道权限挂了不想修复

现在,上下文是 this article from Microsoft

services.AddAuthorization(options =>
{
    var defaultAuthorizationPolicyBuilder = new AuthorizationPolicyBuilder(
        JwtBearerDefaults.AuthenticationScheme,
        "AnotherJwtBearerSchemee");
    defaultAuthorizationPolicyBuilder = 
        defaultAuthorizationPolicyBuilder.RequireAuthenticatedUser();
    options.DefaultPolicy = defaultAuthorizationPolicyBuilder.Build();
});

As the default authorization policy is overridden, it's possible to use the [Authorize] attribute in controllers. The controller then accepts requests with JWT issued by the first or second issuer.

现在,上述功能有效,具有第一或第二权限的用户可以成功验证我的服务。但是 - 当其中一个权限关闭时,整个身份验证失败,这令人沮丧,因为我想使用任一权限进行身份验证,但最终取决于两者是否在线

我的问题是:如果其中一位权威人士未能回答,是否仍然可以忽略异常。或者,如果有另一种方法可以实现 MS Doc "The controller then accepts requests with JWT issued by the first or second issuer"

中引用的预期行为

这是开发团队的设计决定。他们不会在未来的任何时候改变它。 此问题的解决方法是使错误静音,以防止整个操作失败。将这段代码添加到 AddJwtBearer

        options.Events = new JwtBearerEvents()
        {
            OnAuthenticationFailed = context =>
            {
                context.NoResult();
                return Task.FromResult(0);
            }
        };

Issue ref