10

We can find two separate packages in the NuGet gallery:

Both seem to receive regularly updated and have millions of downloads.

I know that System.IdentityModel.Tokens.Jwt has a dependency on Microsoft.IdentityModel.Tokens, but I don't know which one should I use in my ASP.NET Core 2.0 application.

I'm using Microsoft.IdentityModel.Tokens now and it is good enough to create JWT tokens and validate them.

Do I need to add System.IdentityModel.Tokens.Jwt to my project and change any code?

PS: I am not using Azure services in this project.

Tohid
  • 6,175
  • 7
  • 51
  • 80

1 Answers1

5

As you pointed out System.IdentityModel.Tokens.Jwt has a dependency on Microsoft.IdentityModel.Tokens

Dependency

As suggested in Link you should use the System.IdentityModel.Tokens.Jwt nuget as Microsoft.IdentityModel.Tokens is the older library.

eVolve
  • 1,340
  • 1
  • 11
  • 30
  • 2
    It's the opposite of what you said. System.IdentityModel.Tokens.Jwt (starts 2013) is much older than Microsoft.IdentityModel.JsonWebTokens (starts 2018) See: https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/wiki Regarding Microsoft.IdentityModel.JsonWebTokens - "This is a newer, faster version of System.IdentityModel.Tokens.Jwt that has additional functionality." – Phil B Aug 31 '22 at 18:12