-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JWT.Headers() return type is different between .NET Core and .NET Framework #72
Comments
Hi @sandersaares , well, this is difference between I can't think of any good way to align those (let me know if you have an idea). Simply because there can be anything in a header. Possible options are:
var test = JWT.Headers(header, new JwtSettings().RegisterMapper(new NewtonsoftMapper()));
|
Something along this probably: https://stackoverflow.com/questions/31119200/how-to-tell-json-net-to-deserialize-jarray-to-a-listobject-when-object-type-is |
I see what you mean. So .Headers() just returns the raw output of the deserialization because it is just arbitrary JSON. Okay, understood. Forcing Newtonsoft.Json will probably be an OK solution for my case. Thanks for quick explanation! |
I'll open follow up #73 . Probably will consider in a future. Returning Newtonsoft specific classes seems slightly odd to me right now. |
Given this JOSE object;
JWT.Headers()
returns the following on .NET Framework 4.7:And the following on .NET Core 2.0:
Those x5c values are
object[]
andSystem.Collections.Generic.ICollection<Newtonsoft.Json.Linq.JToken>
, respectively.This difference in data types is making it difficult to write portable code. The
Headers()
function should return the same thing for the same input data on every platform.The text was updated successfully, but these errors were encountered: