diff --git a/JWT/JWT.cs b/JWT/JWT.cs index 27cbb86cd..0ee2b1eab 100755 --- a/JWT/JWT.cs +++ b/JWT/JWT.cs @@ -186,13 +186,26 @@ public static string Decode(string token, string key, bool verify = true) /// Whether to verify the signature (default is true). /// An object representing the payload. /// Thrown if the verify parameter was true and the signature was NOT valid or if the JWT was signed with an unsupported algorithm. - public static object DecodeToObject(string token, string key, bool verify = true) + public static object DecodeToObject(string token, byte[] key, bool verify = true) { var payloadJson = JsonWebToken.Decode(token, key, verify); var payloadData = JsonSerializer.Deserialize>(payloadJson); return payloadData; } + /// + /// Given a JWT, decode it and return the payload as an object (by deserializing it with ). + /// + /// The JWT. + /// The key that was used to sign the JWT. + /// Whether to verify the signature (default is true). + /// An object representing the payload. + /// Thrown if the verify parameter was true and the signature was NOT valid or if the JWT was signed with an unsupported algorithm. + public static object DecodeToObject(string token, string key, bool verify = true) + { + return DecodeToObject(token, Encoding.UTF8.GetBytes(key), verify); + } + /// /// Given a JWT, decode it and return the payload as an object (by deserializing it with ). ///