title: Openiddict introspect not working (The access token is not valid.)
body: <p>I have 3 projects 1- SPA, 2- Web API Project, 3- Identity (setup using openiddict, ASP.NET Core 2.0 (OpenIddict.dll version 2.0.0.-rc2-0854) with EF Core.</p>
  
  <p>API and Identity Server run successfully, can get the jwt token but, when I try to get value from API method which has Authorize Attribute I get an error:</p>
  
  <pre><code>WWW-Authenticate →Bearer error="invalid_token", error_description="The access token is not valid." 
  </code></pre>
  
  <p>In Application Insights, could see POST /connect/introspect getting called, with result Dependency result code:500 and Dependency code: Http</p>
  
  <p>Same code worked before, not sure which changes break introspect.</p>
  
  <p>configuration in API project</p>
  
  <pre><code> services.AddAuthentication(options =&gt;
          {
              options.DefaultScheme = OAuthIntrospectionDefaults.AuthenticationScheme;
          })
            .AddOAuthIntrospection(options =&gt;
            {
                options.Authority = new Uri("http://localhost:49888");
                options.ClientId = "my-resource-server";
                options.ClientSecret = "ClientSecret";
                options.RequireHttpsMetadata = false;
            });
          services.AddCors();           
          services.AddMvc()
              .AddJsonOptions(options =&gt;
               {
                   options.SerializerSettings.Formatting = Formatting.None;
               });
  </code></pre>
  
  <p>Authorized Method</p>
  
  <pre><code>  [HttpGet("GetData/{Id}")]
      [Authorize(AuthenticationSchemes = OAuthIntrospectionDefaults.AuthenticationScheme)]
      [Authorize(Roles = "Admin")]
      public IActionResult GetData(int courseId)
      {
   }
  </code></pre>
  
  <p>connect/introspect in Identity Project</p>
  
  <pre><code>  private async Task&lt;AuthenticationTicket&gt; CreateTicketAsync(OpenIdConnectRequest request, UserInfo user)
      {
          UserInfo userInfo = await _userRepository.GetUserByCredentials(request.Username, request.Password);
  
          if (userInfo == null)
          {
              return null;
          }
  
          // Create a new ClaimsIdentity holding the user identity.
          var identity = new ClaimsIdentity(
              OpenIdConnectServerDefaults.AuthenticationScheme,
              OpenIdConnectConstants.Claims.Name,
               OpenIdConnectConstants.Claims.Role
             );
  
          // Add a "sub" claim containing the user identifier, and attach
          // the "access_token" destination to allow OpenIddict to store it
          // in the access token, so it can be retrieved from your controllers.
          identity.AddClaim(OpenIdConnectConstants.Claims.Subject,
              user.UserId.ToString(),
              OpenIdConnectConstants.Destinations.AccessToken);
          identity.AddClaim(OpenIdConnectConstants.Claims.Name, user.Name,
              OpenIdConnectConstants.Destinations.AccessToken);
  
          identity.AddClaim(OpenIdConnectConstants.Claims.Role, user.Role,
             OpenIdConnectConstants.Destinations.AccessToken);
  
          // ... add other claims, if necessary.
          var principal = new ClaimsPrincipal(identity);
  
          // Create a new authentication ticket holding the user identity.
          var ticket = new AuthenticationTicket(principal,
              new Microsoft.AspNetCore.Authentication.AuthenticationProperties(),
              OpenIdConnectServerDefaults.AuthenticationScheme);
  </code></pre>
  
  <p>.
  .</p>