Q:

No SecurityTokenValidator available for token

I created an IdentityServer and can successfully retrieve a token by passing the ClientId and ClientSecret to the token endpoint
My IndetityServer setup is below
var certFile = env.ApplicationBasePath + $"{Path.DirectorySeparatorChar}idsrv3test.pfx";

var options = new IdentityServerOptions
{
    Factory = new IdentityServerServiceFactory()
        .UseInMemoryClients(Client.Get())
        .UseInMemoryScopes(Scope.Get())
        .UseInMemoryUsers(User.Get()),
            SigningCertificate = new X509Certificate2(certFile, "idsrv3test"),
            RequireSsl = false
};

app.UseIdentityServer(options);

When I make a call to my protected MVC 6 Web API, I get a

No SecurityTokenValidator available for token:
  c7f2c3890d83a454fcb504cb96c75fe7

Here is the setup in the Startup.cs of my API
app.UseJwtBearerAuthentication(options =>
{
    options.Authority = $@"{tokenServiceUrl}";
    options.Audience = $@"{tokenServiceUrl}/resources";
    options.AutomaticAuthenticate = true;
    options.RequireHttpsMetadata = false;
});

I made sure that this setup is done before the app.UseMvc() call. Is there anything else that I have to do?

A:

Run 

Install-Package
  IdentityServer3.AccessTokenValidation.Integration.AspNet -Pre

from the package manager console to install the integration package for your API. Then add the folloing code to the Configure method for the Startup.cs class of the API
app.UseIdentityServerBearerTokenAuthentication
(
    new IdentityServerBearerTokenAuthenticationOptions
    {
        Authority = tokenServiceUrl,
        ValidationMode = ValidationMode.ValidationEndpoint,
        RequiredScopes = new[] { "SomeScope" }
    }
);

