jwt
jwt copied to clipboard
RSA Example in the documentation does not work
var payload = new Dictionary<string, object>
{
{ "claim1", 0 },
{ "claim2", "claim2-value" }
};
IJwtAlgorithm algorithm = new RS256Algorithm(certificate);
IJsonSerializer serializer = new JsonNetSerializer();
IBase64UrlEncoder urlEncoder = new JwtBase64UrlEncoder();
IJwtEncoder encoder = new JwtEncoder(algorithm, serializer, urlEncoder);
var token = encoder.Encode(payload);
Console.WriteLine(token);
The error is Encode is asking for more parameters . Could we amend the code example . The environment is .net 4.0
After alot of trying an example of creating and decoding a JWT token is here. I tested on .net 4.0 and it works
https://gist.github.com/ssippe/8fc11c4d7e766e66f06db0431dba3f0a
The current library not sure what is the issue but does not work on .net 4.0
The example uses a different library, Jose Jwt.
I haven't heard of other reports that it doesn't work on .NET 4.0, I'll give it a try once near my computer.