JWTSecurityTokenHandler and SecurityTokenDescriptor not found although System.IdentityModel.Tokens is installed and used

I am trying to write a method to generate a JWT token in .net C #. Internet Search I found pages demonstrating how to do this. One such next page is https://gist.github.com/pmhsfelix/4151369 . To support this, I ran " Install-Package System.IdentityModel.Tokens.Jwt " in the package manager console and could see " <package id="System.IdentityModel.Tokens.Jwt" version="4.0.2.205111437" targetFramework="net45" />" in my paackages.config. Nevertheless, SecurityTokenDescriptor was not found. I have a strong feeling that this is an incorrect version, but I can’t find out what it is. Can someone help me fix this?

+5
source share
1 answer

Make sure you use:

 using System.IdentityModel.Tokens; using Microsoft.IdentityModel; 

In addition, I believe that you will need to add a link to:

System.IdentityModel

which is on the Assemblies tab in Visual Studio.

Hope this helps you.

+6
source

All Articles