Thursday, June 07, 2018

Error: 'IApplicationBuilder' does not contain a definition for 'UseIdentityServerAuthentication' and...

When I was trying to implement security to one of my .net core Web API, I encountered below error

'IApplicationBuilder' does not contain a definition for 'UseIdentityServerAuthentication' and no extension method 'UseIdentityServerAuthentication' accepting a first argument of type 'IApplicationBuilder' could be found (are you missing a using directive or an assembly reference?)

After long struggle, I found that .Net Core 2.0 does not support the security the way .NET Core 1.0 used to support, Code need to rewritten in different way, actually need to follow the steps to migrate your Web API to .NET Core 2.0 using Microsoft.AspNetCore.Authentication.JwtBearer; 

Please follow migration steps to resolve this issues
https://elanderson.net/2017/09/identity-server-api-migration-to-asp-net-core-2/