JWT: How to securely stores cookies.
What is JWT?
JWT stands for JSON Web Token. It's a compact, URL-safe means of representing claims to be transferred between two parties. The claims in a JWT are encoded as a JSON object that is used as the payload of a JSON Web Signature (JWS) structure or as the plaintext of a JSON Web Encryption (JWE) structure, enabling the claims to be digitally signed or integrity protected with a Message Authentication Code (MAC) and/or encrypted.
But... Let's skip the long words.
in short JWT or JSON Web Token is way to stores data safely and we're going to applies it cookies. So, let's get start.
- Let start with installing dependency.
npm i jsonwebtoken
- Now let's create create new endpoint