What is JWT?
JWT, pronounced “jot”, is an open industry standard (RFC 7519) for safely passing claims between multiple parties. Claims can be information about a certain party or object, such as the email address, user ID, and roles of a user. In our case, we will pass JWTs between our backend and frontend.
JWT is used by many products and services and is supported by third-party authentication providers, such as Auth0, Okta, and Firebase Auth. It is easy to parse JWTs as we only need to base64 decode them and parse the JSON string. After verifying the signature, we can be sure that the JWT is authentic and trust the claims within it.
JWTs consist of the following components:
- Header: Containing the algorithm and token type
- Payload: Containing the data/claims of the token
- Signature: For verifying that the token was created by a legit source
These three components form a JWT as they’re joined into a single string, separated by a period...