One advantage of a JWT over a cookie seems to be that it bypasses the origin restrictions on cookies.
Can someone help me understand any other advantages and importantly any other disadvantages to JWTs?
In both approaches the client side must securely save the “cookie” or the “jwt token”. The main difference is that in case of the JWT approach the server does not need to maintain a DB of sessionId for lookup.
Benefits. There are benefits to using JWTs when compared to simple web tokens (SWTs) and Security Assertion Markup Language (SAML) tokens. More compact: JSON is less verbose than XML, so when it is encoded, a JWT is smaller than a SAML token. This makes JWT a good choice to be passed in HTML and HTTP environments.
JWT is commonly used for managing authorization. There exists an open industry standard called RFC-7519, which defines how JWT should be structured and how to use it for exchanging information (called “claims”) in the form of JSON objects. This information can be verified and trusted as its digitally signed.
Tokens, usually referring to JSON Web Tokens (JWTs), are signed credentials encoded into a long string of characters created by the server. The main difference between cookies and tokens is their nature: tokens are stateless while cookies are stateful.
a lot of web-related info can be found in a similar post here: Token Authentication vs. Cookies; I would like to call out some "architectural" differences:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With