title: IDX10214: Audience validation failed. Audiences: '[PII is hidden]'
body: <p>I have web app using azureb2c for authentication. Have 3 APIs which are called by web app via Ocelot gateway using HttpClient. After authentication, when a request is made to an API via gateway the request is made to the specific API and the required response is served. However while reading the response there is an exception thrown at below line</p>
  
  <pre><code>var result = await response.Content.ReadAsStringAsync();
  </code></pre>
  
  <p><strong>IDX10214: Audience validation failed. Audiences: ‘[PII is hidden]’. Did not match: validationParameters.ValidAudience: ‘[PII is hidden]’ or validationParameters.ValidAudiences: ‘[PII is hidden]’.</strong></p>
  
  <p>I have tested the API individually using postman and it works.</p>
  
  <p>I have the code configured for each client similar to below</p>
  
  <pre><code>services.AddHttpClient&lt;IApiClient, ApiClient&gt;()
                  .AddHttpMessageHandler&lt;AccessTokenHandler&gt;()
                  .AddHttpMessageHandler&lt;ValidateHeaderHandler&gt;()
                  .AddTransientHttpErrorPolicy(policyBuilder =&gt; policyBuilder.RetryAsync(2))
                  .AddTransientHttpErrorPolicy(policyBuilder =&gt; policyBuilder.CircuitBreakerAsync
                   (
                      handledEventsAllowedBeforeBreaking: 2,
                      durationOfBreak: TimeSpan.FromMinutes(1)
                   ));
  </code></pre>