JSON Web Token

Prakash Dale · August 9, 2020

What is JSON Web Token?

JSON Web Token is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. This information can be verified and trusted because it is digitally signed. JWT can be signed using a secret (with the HMAC algorithm) or public/private key pair using RSA or ECDSA.

Signed tokens can verify the integrity of the claims contained within it, while encrypted tokens hide those claims of other parties. When tokens are signed using public/private key pairs, the signature also certifies that only the party holding the private key is the one that signed it.

When should you use JSON Web Token?

  • Authorization: This is the most common scenario for using JWT. Once the user is logged in, each subsequent request will include the JWT, allowing the user to access routes, services and resources that are permitted with that token. Single Sign On is a feature that widely uses JWT nowadays, because of its small overhead and its ability to easily used across different domains.

  • Information Exchange: JSON Web Tokes are a good way of securely transmitting information between parties. Because JWT can be signed - for example, using public/private key pairs - you can be sure senders are who they say they are. Additinally, as the signature is calculated using the header and the payload, you can also verify that the content hasn’t been tampered with.

For more details click here

Twitter, Facebook