Here's an example of how to create a JWT token in C# using the System.IdentityModel.Tokens.Jwt
package:
main.cs796 chars25 lines
To generate a token, you can call the GenerateJwtToken
method and pass in the required parameters:
main.cs272 chars11 lines
This will generate a JWT token with the specified claims and an expiration time of 60 minutes. Don't forget to replace {your-secret-key}
, {your-issuer}
, and {your-audience}
with your desired values.
gistlibby LogSnag