What are JWT tokens and their different forms — JWS and JWE?

--

Image Source: https://i0.wp.com/miro.medium.com/max/2400/1*gj4KhcUyERjZPSPwSH7xmA.png?w=584&ssl=1

Hello everyone. In this article, we will be seeing everything you need to know about JWT, JWS, and JWE.

What is JWT?

JSON web token (JWT) is an open standard (RFC 7519) that defines how to contain the information in a JSON format and communicate with different parties. There are many types of tokens used and JWT is just one of them and the most popular one

JWT is smaller in size and very compact that contains all the information a server needs to verify a client. It is very faster and secure and hence widely adopted by many applications and also the frameworks like OAuth and OIDC(Open ID Connect).

There are two different approaches to Managing Sessions in an applications

  1. Session or Cookies based approach
Image Source: https://media.geeksforgeeks.org/wp-content/uploads/20211206163821/Group2copy-660x330.jpg

In this approach, session Ids are stored in a session DB and the server always needs to verify the session Id hence it is stateful which takes a lot of overhead on the server if there are too many sessions being used in the application

2. Token(JSON Web Tokens) based approach

--

--

Dineshchandgr - A Top writer in Technology
Javarevisited

Principal Software Engineer and Technical Lead focussed on Backend Engineering who likes to upgrade the tech skills and share knowledge to the community