private static IJsonSerializer _serializer = new JsonNetSerializer();
private static IDateTimeProvider _provider = new UtcDateTimeProvider();
private static IBase64UrlEncoder _urlEncoder = new JwtBase64UrlEncoder();
private static IJwtAlgorithm _algorithm = new HMACSHA256Algorithm();
public static void Main()
Console.WriteLine("Hello World");
DateTime myDate = GetExpiryTimestamp("eyJhbGciOiJSUzI1NiIsImtpZCI6IlpTT2IwRU9PUE5Tc3FHQ19RemRWdmciLCJ0eXAiOiJhdCtqd3QifQ.eyJuYmYiOjE2NDU2MTgwMzQsImV4cCI6MTY0NTYyMTYzNCwiaXNzIjoiaHR0cHM6Ly9hdXRoc2VydmljZWJldGEuaG90dGdlbnJvdGguZGUiLCJhdWQiOiJMaWNlbnNlU2VydmljZSIsImNsaWVudF9pZCI6IjY1RDY5NUY1LTlGMDAtNDZFRC1CQzNGLTQ1OURDMUU4MEVCRSIsInN1YiI6IjdjMWE4ODU4LTY5NjYtNGFiZC04ZjJhLWFiZDIyMzYxODJhYSIsImF1dGhfdGltZSI6MTY0NTYxODAyOSwiaWRwIjoibG9jYWwiLCJnaXZlbl9uYW1lIjoiZi5zY2hhZWZlckBob3R0Z2Vucm90aC5kZSIsInVzZXJfaWQiOiI3YzFhODg1OC02OTY2LTRhYmQtOGYyYS1hYmQyMjM2MTgyYWEiLCJMaWNlbnNlU2VydmljZS5Sb2xlIjoiQWRtaW4iLCJ0ZW5hbnRfaWQiOiI3NGEzMGJjMi0zMTk1LTQ1ODMtOTI1NC1hNjkzZjgxNGRhZjkiLCJzY29wZSI6WyJvcGVuaWQiLCJMaWNlbnNlU2VydmljZSJdLCJhbXIiOlsicHdkIl19.d-WBLYS_itpDbwoqEhvAePAowar2bMNtsC0rBX5dw3GjiAWgVTj3QMRHKz_ZRbbIuwkjFzIHMMkiYmsQff8u_2zXc9am_anQEl2o-mJwcCpBNxZ4-zGC_h8j2Vgo1XWvjdBnefosM8Ki8dAJpBXS82qEze46puanv7kvi20QsjQW7JiDsymvvNhhwtfqKloTv4-zbeiXhNPgQ2Z33HfBD5AquAoB84pWEGRzTVLPtYoNubBQ8RZvkeBWpJqZ_3fFyT-oeaiNgcHa1Ap_ltegJv7IaH7Q4wq1e9_DdPC9s85bojPlUtfvpE7yF7UxrHzeKuklK_qEbqjN-xroxE52wQ");
Console.Write(myDate.ToString());
public static DateTime GetExpiryTimestamp(string accessToken)
IJwtValidator _validator = new JwtValidator(_serializer, _provider);
IJwtDecoder decoder = new JwtDecoder(_serializer, _validator, _urlEncoder, _algorithm);
var token = decoder.DecodeToObject<JwtToken>(accessToken);
DateTimeOffset dateTimeOffset = DateTimeOffset.FromUnixTimeSeconds(token.exp);
return dateTimeOffset.LocalDateTime;
return DateTime.MinValue;
public long exp { get; set; }