Search code examples
jwt

Why do we need a JWT token?


In my understanding, when a client wants to communicate with a server, HTTPS can be used which involves SSL certificate. This is very secured channel where information is exchanged between client and server by means of a session key. The session key is symmetric which has been generated by means of asymmetric keys (public/private keys).

So I am wondering why there is a need to have JWT in place?


Solution

  • HTTPS, via SSL/TLS encryption, does definitely ensure a secure connection between client and server, protecting data in transit. Its focus is on securing the transport layer, guaranteeing encrypted communication.

    On the other hand, JSON Web Tokens (JWT) are of pivotal importance for authentication and authorization. JWT ensures a secure exchange of user information across application components or services within a distributed system.

    A few other reasons are Statelessness, decoupling and scalability.