Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the different between System.IdentityModel.Tokens & Microsoft.IdentityModel.Tokens? Which one should I use in an ASP.NET Core application?

We can find two separate packages in the NuGet gallery:

  • System.IdentityModel.Tokens.Jwt
  • Microsoft.IdentityModel.Tokens

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.

like image 876
Tohid Avatar asked Jan 05 '19 08:01

Tohid


People also ask

What is Securitytokendescriptor?

Represents the cryptographic key and security algorithms that are used to generate a digital signature.


1 Answers

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.

like image 165
eVolve Avatar answered Oct 09 '22 05:10

eVolve