ASP.NET Core Identity is designed to enable us to easily use a number of different storage providers for our ASP.NET applications. We can use the supplied identity providers that are included with the .NET Framework, or we can implement our own providers. In this tutorial, we will build a Token-Based Authentication using ASP.NET Core Identity , …
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


To migrate JW from core 1.x to core 2.0 proceed as follows

1. Go to project properties and choose .NET Core 2.0 as TargetFramework

2. open ConfigureServices of startup.cs file and paste this line of code :

        services.AddIdentity<MyUser, MyRole>().AddEntityFrameworkStores<SecurityContext>();
        services.AddAuthentication((cfg =>
            cfg.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
            cfg.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
        })).AddJwtBearer(options =>
            options.RequireHttpsMetadata = false;

            options.TokenValidationParameters = new TokenValidationParameters
                ValidIssuer = Configuration["JwtSecurityToken:Issuer"],
                ValidAudience = Configuration["JwtSecurityToken:Audience"],
                ValidateIssuerSigningKey = true,
                IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Configuration["JwtSecurityToken:Key"])),
                ValidateLifetime = true

3. open Configure of Startup.cs class and remove this lines of code :

and app.UseIdentity()

4 . paste this line of code