Azure IDX10214:访问群体验证失败。观众:';[PII隐藏]';

Azure IDX10214:访问群体验证失败。观众:';[PII隐藏]';,azure,azure-active-directory,asp.net-core-webapi,asp.net-core-2.2,ocelot,Azure,Azure Active Directory,Asp.net Core Webapi,Asp.net Core 2.2,Ocelot,我有一个使用azureb2c进行身份验证的web应用程序。有3个API,由web应用程序使用HttpClient通过Ocelot网关调用。认证后,当通过网关向API发出请求时,将向特定API发出请求,并提供所需的响应。但是,在读取响应时,在第行下面抛出了一个异常 var result = await response.Content.ReadAsStringAsync(); IDX10214:观众验证失败。受众:“[PII已隐藏]”。不匹配:validationParameters.Valid

我有一个使用azureb2c进行身份验证的web应用程序。有3个API,由web应用程序使用HttpClient通过Ocelot网关调用。认证后,当通过网关向API发出请求时,将向特定API发出请求,并提供所需的响应。但是,在读取响应时,在第行下面抛出了一个异常

var result = await response.Content.ReadAsStringAsync();
IDX10214:观众验证失败。受众:“[PII已隐藏]”。不匹配:validationParameters.Validudience:“[PII隐藏]”或validationParameters.Validudiences:“[PII隐藏]”。

我已经使用postman单独测试了API,它可以正常工作

我为每个客户机配置了如下类似的代码

services.AddHttpClient<IApiClient, ApiClient>()
                .AddHttpMessageHandler<AccessTokenHandler>()
                .AddHttpMessageHandler<ValidateHeaderHandler>()
                .AddTransientHttpErrorPolicy(policyBuilder => policyBuilder.RetryAsync(2))
                .AddTransientHttpErrorPolicy(policyBuilder => policyBuilder.CircuitBreakerAsync
                 (
                    handledEventsAllowedBeforeBreaking: 2,
                    durationOfBreak: TimeSpan.FromMinutes(1)
                 ));
services.AddHttpClient()
.AddHttpMessageHandler()
.AddHttpMessageHandler()
.AddTransientTTPerorPolicy(policyBuilder=>policyBuilder.RetryAsync(2))
.AddTransientTTPerorPolicy(policyBuilder=>policyBuilder.CircuitBreakerAsync
(
重新分解前处理的事件:2,
中断持续时间:时间跨度从分钟(1)
));
您可以尝试:

if (env.IsDevelopment())
{
     IdentityModelEventSource.ShowPII = true; 
}

此外,您可能需要添加授权,因为默认情况下不包括授权

这对我没有帮助,我仍然收到AuthenticationFailed错误消息。我无法理解当API毫无怨言地发送响应时,为什么以及谁在客户端验证响应。