Decode JWT in the terminal
Do you still use online tools like jwt.io to decode JWT tokens? Ever wonder how they are decoded? Would you like to have a tool right in your terminal to do it? Let's decode the JWT A JWT token has...

Source: DEV Community
Do you still use online tools like jwt.io to decode JWT tokens? Ever wonder how they are decoded? Would you like to have a tool right in your terminal to do it? Let's decode the JWT A JWT token has three parts. It's in the following format: header.payload.signature All three parts are part of the token, but in this article we will only decode the header and payload. The signature is used to verify the token with the secret. We will not be covering that this time. In this article, we will decode a JWT token with Node.js and also write a small command line script so we can decode it from the terminal using jwt <token>. Let's get started. We will do this in steps so you can build along and test it all the way. We will start with a simple function decodeJwt(token) to decode the token We will add support to pass the token while running the script node jwt <token> We will add it as a global script which can be used from anywhere jwt <token> Step 1: Create the decodeJwt func