DEV Community

Anja
Anja

Posted on

2

What is a JSON Web Token?

What is a Json Web Token(JWT)? It is used for Authorization and makes sure that the User who sends a request to an app is the same person as the person who has logged in before. It can be used as an alternative to Sessions. This is how it works:

  1. The user tries to login
  2. The server checks if the login data is correct, and if so, it creates a JWT (signed with a secret key) and sends it back to the user
  3. The user sends another request with the JWT
  4. The server checks if the JWT is correct and the user is allowed to access that resource. If yes, it sends the response with the desired info to the user

The JWT doesnt get stored on the server side it always applies its algorithm to check it on the fly. If you want to learn more, check out this video: https://www.youtube.com/watch?v=7Q17ubqLfaM&feature=youtu.be

Top comments (0)

Cloudinary image

Video API: manage, encode, and optimize for any device, channel or network condition. Deliver branded video experiences in minutes and get deep engagement insights.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay