Reputation: 81
As mentioned, in .Net core we use
var tokenHandler = new JwtSecurityTokenHandler();
var token = tokenHandler.CreateToken(tokenDescriptor);
return tokenHandler.WriteToken(token);
Here what is the difference between CreateToken
and WriteToken
?
Upvotes: 2
Views: 1398
Reputation: 10198
CreateToken method create security token based on the specified token descriptor and return securitytoken object class.
WriteToken method returns string, i.e serializes the specified security token to a string.
Upvotes: 1