3 Create a Web api to protect with IdentityServer - AbassiOmar/IdentityServer4 GitHub Wiki

  1. Create a Web api in your solution "ProtectedApi"
  2. Add the authentication services to DI (dependency injection) and the authentication middleware to the pipeline ConfigurationService DI put the configuration into appsettings.json services.AddAuthentication("Bearer") .AddJwtBearer(options => { options.Audience = this.Configuration["Authentication:Audience"]; options.Authority = this.Configuration["Authentication:Authority"]; options.RequireHttpsMetadata = false; });

Configure pipeline app.UseAuthentication() 3. The last step add [Authorize] attribute in header of controller