How implement JwtSecurityToken or JWT in C# .Net?

Hello, I am new to .net and I am implementing JWT and I find on the direct page of JSON Web Token Libraries - a package which uses System.IdentityModel.Tokens.Jwt so I go directly to the package and I do not find an example code, I go to the Microsoft documentation and I only find dotnet users-jwt which is with a cli command and I need to implement jwt from scratch. Could you help me, where can I get an example where I specify each part?

Hi @santaellaisaac2,
Welcome to the Auth0 Community!

Not sure what you are going to do with JWT, but perhaps this article can help you with JWT validation.


@andrea.chiarelli Thank you very much, it helps me a little to implement JWT, but I would like to know if there is an explanation of JwtSecurityToken in the Microsoft documentation since from what I see it only mentions the class together with its methods and properties, but it does not explain it in detail. Is there other documentation that you can provide me that explains everything about the JwtSecurityToken of the Microsoft.IdentityModel.Jwt package, I would be very grateful.

Hey @santaellaisaac2,
Honestly, I’m not aware of any detailed documentation on Microsoft’s website about using the JwtSecurityToken class. Actually, this class is nothing more than an implementation of the JWT specification, so I’m not really surprised about the lack of detailed documentation. I mean, the class just represents a JWT with no specific behavior.
Here is also a light introduction to JWTs structure.

I hope this helps.

1 Like