How to create JWT token using REST api in c#

Hey,

Please find the below code for your reference.

public string GenerateToken ()
{
var tokenHandler = new JwtSecurityTokenHandler();
var now = DateTime.UtcNow;
var apiSecret = “”;
byte symmetricKey = Encoding.ASCII.GetBytes(apiSecret);

var tokenDescriptor = new Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor
{
Issuer = “”,
Expires = now.AddSeconds(30),
SigningCredentials = new Microsoft.IdentityModel.Tokens.SigningCredentials(new Microsoft.IdentityModel.Tokens.SymmetricSecurityKey(symmetricKey), Microsoft.IdentityModel.Tokens.SecurityAlgorithms.HmacSha256),
};
var token = tokenHandler.CreateToken(tokenDescriptor);

var tokenString = tokenHandler.WriteToken(token);
}

I think the problem is with dll. Can you tell me the version for dll