What is JSON Web Token and how to use it?

Explaining JWT to a Kid

4 Likes

A JSON Web Token (JWT) is a special king of message that has some information about you and what you can do. It is like a ticket that you get when you enter a park or a museum. The ticket has your name, the date, and the places you can visit. The ticket also has a stamp or a sticker that shows that it is valid and not fake. You can use the ticket to go to different places in the park or the museum without having to show your ID or pay again. The people who work there can check your ticket and see if you are allowed to enter or not.

A JWT is similar, but it is used on the internet. It has three parts: a header, a payload, and a signature. The header tells what kind of message it is and how it was made. The payload has the information about you and what you can do, like your name, your role and your permissions. The signature is like the stamp or the sticker that proves that the message is valid and not fake. It is made by using a secret code or a key that only the sender knows.

You can use a JWT to access different websites or services that trust the sender of the message. For example, if you log in to the website with your username and password, the website can give you a JWT that says who you are and what you can do on the website. Then, you can use the JWT to visit different pages or features on the website without having to log in again. The website can check your JWT and see if your are allowed to access them or not.

A JWT is useful because it is small, fast and secure. It is small because it uses a special way of writing data called JSON that makes it easy to read and write. It is fast because it does not need to talk to a database or a server to check if it is valid or not. It is secure because it has a signature that cannot be changed or faked by anyone who does not know the secret code or the key.

6 Likes

Would be useful if you can tell how to use jwt token in vFlow and vdesigner

@Nikhil.Dhanda Could you please explain how to use JWT token in vFlow

1 Like