Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exception using System.IdentityModel.Tokens.Jwt 5.0.0.127 in Web Api 2 built on .Net 4.6

I have updated my existing Web Api project to use the latest System.IdenityModel.Tokens.Jwt package and I am getting the following error:

Could not load type 'System.IdentityModel.Tokens.TokenValidationParameters' from assembly 'System.IdentityModel.Tokens.Jwt, Version=5.0.0.127, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Everything works fine with 4.0 version of the same package. How can I resolve this?

like image 234
Soma Yarlagadda Avatar asked Jul 06 '16 20:07

Soma Yarlagadda


1 Answers

If you want to use the new version(v5) of System.IdentityModel.Tokens.Jwt and don't want to restrict your project to the v4 version, I have created a Nuget and Github project called EasyJwtAuth that uses v5(Very simple to use):

Nuget package: https://www.nuget.org/packages/EasyJwtAuth

Instructions on how to use: https://github.com/Xela101/EasyJwtAuth

Feel free to update the repository with more features, or just learn/copy the code and make your own authentication wrapper.

like image 82
Xela Avatar answered Oct 27 '22 20:10

Xela