
JSON Web Token
โญ JSON Web Token
JSON Web Token (JWT) is quite popular and used for #authentication๐ฅ โ๐ป It's a token-based standard that allows us to securely transfer information between two parties without storing anything in a database. JWT token consists of three parts:
- โ๏ธ Header
- โ๏ธ Payload
- โ๏ธ Signature
Each one is BaseURL64 encoded to form the token.
๐๐๐ ๐๐ฎ๐ญ๐ก๐๐ง๐ญ๐ข๐๐๐ญ๐ข๐จ๐ง ๐๐จ๐ฅ๐ฅ๐จ๐ฐ๐ฌ ๐ ๐ฌ๐ข๐ฆ๐ฉ๐ฅ๐ 4 ๐ฌ๐ญ๐๐ฉ ๐ฉ๐ซ๐จ๐๐๐ฌ๐ฌ
Client (Browser) ๐ sends post request with credentials to auth server to authenticate themselves
Auth Server ๐ authenticates user credentials and generates a JWT. The server does not store anything and sends the token to the browser to save. It allows users to authenticate without their credentials in the future. It's best advised to store the token in an http-only cookie.
Thereafter ๐ for every request the client sends the JWT in the authorization header. Validation happens using token introspection with the auth server.
Once validated, the resource server ๐ sends the necessary data to the client. ๐จ This covers a basic understanding of how JWT works. There's much more to it.
โ Reading it from jwt.io would provide better insights.
โก๏ธ If you find this post helpful, share it with your connections (Let's help each other grow ๐๐ป)
โก๏ธ๐ฅ Don't forget to save this Post!
โก๏ธFollow Abdul Haseeb Khan for more.
Happy watching and learning! ๐