I have a conflict when using System.IdentityModel.Tokens :
using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.
May be you are using Jwt version 5.0.0.0 or above. I have faced the same issue before.
The new version of JWT handler accepts Microsoft.IdentityModel.Tokens namespace.
var tokenDescriptor = new Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor
{
Subject = claimsIdentity,
Audience = allowedAudience,
Issuer = issuerName,
Expires = DateTime.MaxValue,
SigningCredentials = new Microsoft.IdentityModel.Tokens.SigningCredentials(
new Microsoft.IdentityModel.Tokens.SymmetricSecurityKey(symmetricKey), //symmetric key
System.IdentityModel.Tokens.SecurityAlgorithms.HmacSha256Signature,
System.IdentityModel.Tokens.SecurityAlgorithms.Sha256Digest)
};
var tokenHandler = new JwtSecurityTokenHandler();
var token = tokenHandler.CreateToken(tokenDescriptor);