1.

What are the use cases for JWT?

Answer»

There are MANY useful scenarios for leveraging the power of JWT-

  • Authentication 

Authentication is one of the most common scenarios for USING JWT, specifically in microservices architecture (but not limited to it). In microservices, the oauth2 server generates a JWT at the time of login and all subsequent requests can include the JWT AccessToken as the means for authentication. Implementing Single Sign-On by sharing JWT b/w different applications hosted in different domains.

  • Information Exchange 

JWT can be signed, using public/private key pairs, you can be sure that the senders are who they say they are. Hence JWT is a good way of sharing information between two parties. An example use case could be - 

  1. GENERATING Single Click Action Emails e.g. Activate your account, delete this comment, ADD this item to favorites, Reset your password, etc. All required information for the action can be put into JWT.
  2. Timed sharing of a file download using a JWT link. Timestamp can be part of the claim, so when the server time is past the time-coded in JWT, the link will automatically expire. 


Discussion

No Comment Found