SymmetricSecurityKey in ASP.NET CORE

Viewed 6875

I'm trying to create Asp.NET Core API and add Jwt authentication. In all examples, that I've found so far is used SymmetricSecurityKey. I've added Aspnetcore.Authentication.JwtBearer package but there is doesn't exist SymmetricSecurityKey. What package I've to add to resolve dependency to this class?

Thank you in advance.

3 Answers

For .NET Core 3.0:

A lot of things have been broken off into individual packages that have to be added to your project. Therefore:

$ dotnet add package Microsoft.AspNetCore.Authentication.JwtBearer --version 3.0.0

Which adds the following line to the .csproj:

<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.0.0" />

At that point, as other answers have stated, you can import:

using System.IdentityModel.Tokens.Jwt;

Nuget Package Link

Related