I just have seen this post but it is not completely what I need...
I have seen that with Core 8 I don't get no more a success response when I call API function with this code:
var claims = new[]
{
new Claim(JwtRegisteredClaimNames.Sub, user.UserName),
new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()),
new Claim(ClaimTypes.Role, "Administrator")
};
var token = new JwtSecurityToken(
issuer: "http://portaleWeb.com",
audience: "http://portaleWeb.com",
expires: DateTime.UtcNow.AddHours(1),
claims: claims,
signingCredentials: new SigningCredentials(signingKey, SecurityAlgorithms.HmacSha256));
return Ok(new
{
token = new JwtSecurityTokenHandler().WriteToken(token),
expiration = token.ValidTo
});
I read that now the object is a JsonWebToken, but don't know how to change the code...
Someone that can help me?