using JWT;
using JWT.Algorithms;
using JWT.Serializers;
using JWT.Exceptions;
using System;
using System.Collections.Generic;
using System.Text.Json;
string responsePayload = "{\"payload\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtZXJjaGFudElEIjoiMDE0MDAyMDI0MDExMTEyIiwiaW52b2ljZU5vIjoiSU5WMTIzNDU2IiwiZGVzY3JpcHRpb24iOiJpdGVtIDEiLCJhbW91bnQiOjEwMDAsImN1cnJlbmN5Q29kZSI6IlRIQiIsInBheW1lbnRDaGFubmVsIjpbIkNDIl19.IeJ2WVmHyhYrKsEfX-EOXxoAFQKkYGUUYz0VO3YmuAY "}";
var responseJSON = JsonSerializer.Deserialize<Dictionary<string, string>>(responsePayload);
string responseToken = responseJSON["payload"];
string secret = "109B5916B12617F59A52ACB95E2183095FC15625E33F4342D6D185F5AA512BFC ";
try
{
var algorithm = new HMACSHA256Algorithm();
var decoder = new JwtDecoder(new JsonNetSerializer(), new JwtValidator(new UtcDateTimeProvider()), new JwtBase64UrlEncoder(), algorithm);
var payload = decoder.Decode(responseToken, secret, verify: true);
}
catch catch (Exception ex)
{
Console.WriteLine($"An error occurred: {ex.Message}");
}