title: How to support multiple authentication scheme in Web API Core 2?
body: <p>I'm developing a web api core 2.0 project.</p>
  
  <p>I need support two authorization types: jwt and basic.</p>
  
  <p>Inside my <strong>ConfigureServices</strong> method I've added this code:</p>
  
  <pre><code>services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer((options) =&gt;
  {
      options.Authority = $"...";
      options.Audience = "...";
  });
  
  services.AddAuthentication(BasicAuthenticationDefaults.AuthenticationScheme)
  .AddBasicAuthentication(credentials =&gt;
  Task.FromResult(
     credentials.username == "username"
     &amp;&amp; credentials.password == "password"));
  </code></pre>
  
  <p>Inside my <strong>Configure</strong> method I've added this code:</p>
  
  <pre><code>app.UseAuthentication();
  app.UseMvc();
  </code></pre>
  
  <p>And finally I've added <strong>AuthorizeAttribute</strong> on my controller:</p>
  
  <pre><code>[Authorize]
  public class MioController : Controller
  { ... }
  </code></pre>
  
  <p>Actually work only the last authentication specified on <strong>ConfigureServices</strong>.</p>
  
  <p>How can I support both authentication types?
  Thanks</p>
  
  <p><em>Note: I'm using this NuGet package for basic authentication <a href="https://github.com/bruno-garcia/Bazinga.AspNetCore.Authentication.Basic" rel="noreferrer">Bazinga.AspNetCore.Authentication.Basic</a>.</em></p>