You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure if this is a flaw in JWT specification or if I don't understand something. In JWT, the order of JSON key, value pairs matters when encoding and decoding tokens. Having {"alg": "HS256", "typ": "JWT"} headers produces different token compared to {"typ": "JWT", "alg": "HS256"}.
This seems weird to me because JSON specification states that the key, value pairs do not have an order: An object is an unordered set of name/value pairs. An object begins with { (left brace) and ends with } (right brace). Each name is followed by : (colon) and the name/value pairs are separated by , (comma).source.
Do you have an explanation for this?
The text was updated successfully, but these errors were encountered:
Ok, I just figured out why this doesn't matter. As long as the secret is same, the token will work even though it looks different. The receiving part will use the secret to decode the token and even though the headers or payload are in different order, the end result is the same.
I'm not sure if this is a flaw in JWT specification or if I don't understand something. In JWT, the order of JSON key, value pairs matters when encoding and decoding tokens. Having
{"alg": "HS256", "typ": "JWT"}
headers produces different token compared to{"typ": "JWT", "alg": "HS256"}
.This seems weird to me because JSON specification states that the key, value pairs do not have an order:
An object is an unordered set of name/value pairs. An object begins with { (left brace) and ends with } (right brace). Each name is followed by : (colon) and the name/value pairs are separated by , (comma).
source.Do you have an explanation for this?
The text was updated successfully, but these errors were encountered: