Although JWT is commonly used for managing authorization, the idea behind JWT is to define a standard way for two parties to communicate information securely.
RFC7519 standard simply dictates - how the JSON data should be structured - ways to encrypt it - ways to sign itFirst, a JWT has a strictly defined structure to represent your data.
A JWT token structure contains three parts, and each part is separated by a comma.
HEADER. PAYLOAD.SIGNATURE
A few other characteristics of a JWT token are that it's compact, self-contained, and fast.
- Compact because it's just a simple string, it can be easily sent/receive via URL, post, and HTTP headers. This also helps in faster transfer.
- Self-contained because this encoded string contains all the required info about the user.
- Fast because since we've all the info available in the token, we can avoid making user details query to the database more than once
No comments:
Post a Comment