i am trying to generate a valid JWT Token with C#, My code is
string secret = "6ASu2c8V/zF..........******"; // base64encoded
var payload = new Dictionary<string, string>
{
{"iss", "http://webapi.one*******"},
{"exp", "1498140965"},
{"aud", "ONE****"},
{"playauth", "Ygo2s********"}
};
IJwtAlgorithm algorithm = new HMACSHA256Algorithm();
IJsonSerializer serializer = new JsonNetSerializer();
IBase64UrlEncoder urlEncoder = new JwtBase64UrlEncoder();
IJwtEncoder encoder = new JwtEncoder(algorithm, serializer, urlEncoder);
var token = encoder.Encode(payload,secret);
return token;
When i run the code it generated token
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOi8vd2ViYXBpLm9uZXJlZWwubmV0IiwiZXhwIjoxNDk4MTQwOTY1LCJhdWQiOiJPTkVSRUVMIiwicGxheWF1dGgiOiJZZ28yc2Nob29sQG5pdGU5JCJ9.MuWc9tebE8IZFOIFsh2E_JP-UFQl4UZ9kTBG19_REnM
but this token shows invalid signature on https://jwt.io/ and i used the correct secret key on Verify Signature
28f029d79bedb87....), whereas yours is (apparently) base64 encoded. - user47589