What is the JWT ?

What is the purpose of usage of the JWT ?

Authentication is proving yourself to the server like saying “that’s me” but authorization is saying something like “remember me ?”.

JWT can be obtained after the authentication and after that you can access the resources in the server with your ticket; yes it can be called as ticket like in cinema; firstly you need to log in the cinema system with your name and a couple of bucks and then you get access to cinema with your ticket after 1, 2 or 3 days later, if your ticket is not expired you can enter the cinema with your ticket.

In the same way after we logged in with our email and password -by the way it is authentication- then we get our token which is JWT apparently. After this process we can access the server resources with help of our token unit it expired.

Let's Break It Into Its Parts

Since we’ve seen all the processes of the parts of JWT we can create one of them with help of two base64 converting and two dots.

JWT = Base64Encode(Header).Base64Encode(Payload).Signature

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IlNlZmEgS2FwxLFzxLF6IiwianRpIjoiNGI1ZmNlYTYtMmE1ZS00YTlkLTk3ZjItM2Q4NjMxZWEyYzVhIiwiaWF0IjoxNTIxMTkxOTAyLCJleHAiOjE1MjExOTU2MzAsImFkbWluIjp0cnVlfQ.6JDrXJ7aFP7a7-h87a-qs9TUrkE4eKauoIBc7hb20qA