title: Bearer error - invalid_token - The signature key was not found
body: <p>I have an Angular 7 application interfacing with a .Net Core 2.2 API back-end.  This is interfacing with Azure Active Directory.</p>
  
  <p>On the Angular 7 side, it is authenticating properly with AAD and I am getting a valid JWT back as verified on <a href="https://jwt.io/" rel="noreferrer">jwt.io</a>.</p>
  
  <p>On the .Net Core API side I created a simple test API that has <code>[Authorize]</code> on it.</p>
  
  <p>When I call this method from Angular, after adding the Bearer token, I am getting (as seen in Chrome Debug Tools, Network tab, "Headers"):</p>
  
  <blockquote>
    <p>WWW-Authenticate: Bearer error="invalid_token", error_description="The
    signature key was not found"</p>
  </blockquote>
  
  <p>With a <em>HTTP/1.1 401 Unauthorized</em>.</p>
  
  <p>The simplistic test API is:</p>
  
  <pre><code>    [Route("Secure")]
      [Authorize]
      public IActionResult Secure() =&gt; Ok("Secure works");
  </code></pre>
  
  <p>The Angular calling code is also as simple as I can get it:</p>
  
  <pre><code>    let params : any = {
          responseType: 'text',
          headers: new HttpHeaders({
              "Authorization": "Bearer " + token,
              "Content-Type": "application/json"
          })
      }
  
      this.http
          .get("https://localhost:5001/api/azureauth/secure", params)
          .subscribe(
              data =&gt; { },
              error =&gt; { console.error(error); }
          );
  </code></pre>
  
  <p>If I remove the <code>[Authorize]</code> attribute and just call this as a standard <code>GET</code> request from Angular <em>it works fine</em>.</p>
  
  <p>My Startup.cs contains:</p>
  
  <pre><code>        services
              .AddAuthentication(AzureADDefaults.AuthenticationScheme)
              .AddAzureADBearer(options =&gt; this.Configuration.Bind("AzureAd", options));
  </code></pre>
  
  <p>The options are all properly set (such as ClientId, TenantId, etc) in the appsettings.json and <code>options</code> here is populating as expected.</p>