How JWT token works internally?
1 min readJan 21, 2024
In this article we are going to see how JWT token flow works end to end internally. You can refer this link on what is JWT and its advantages and disadvantages.
Steps involved in JWT end to end control flow:
- User sends a login request with username and password
- Server receives login request
- Server retrieve existing user details from database
- Server verifies user provided username, password with user details from the database
- if username password is valid, server will generate JWT token with secret key
- Server append JWT token in the login response
- For all subsequent requests from user will have to send JWT token in the request header Authorization
- If JWT token available in the headers, token will be decrypted with the help of secret
- After successfully decryption will provide user details and expiry date
- if expiry date is valid, check for use details. if user details are also valid process the request.