Week 17 - Session 2 - User Authentication - JSON Web Tokens

blog image source
JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. This information can be verified and trusted because it is digitally signed. JWTs can be signed using a secret (with HMAC algorithm) or a public/private key pair using RSA.

JSON Web Token (JWT) Process:
  1. Encrypted string issued by the web server
  2. Stored by the client, typically in local storage
  3. Web server signs token using a SECRET KEY
  4. When the token is sent back to the server, can verify it using the secret key
  5. If the token is tampered with, verification will fail
A JWT consist of three parts:
  • Header; consists of two parts: the type of the token, which is JWT, and the hashing algorithm.
  • Payload; which contains the claims which are an entity (typically, the user) and additional metadata.
  • Signature; takes the encoded header, the encoded payload, a secret, the algorithm specified in the header, and sign that.
JWT - https://jwt.io/
5 Easy Steps to Understanding JSON Web Tokens (JWT) - https://medium.com/vandium-software/5-easy-steps-to-understanding-json-web-tokens-jwt-1164c0adfcec

Popular posts from this blog

Week 9 to 12 - Learning with MCR Codes

Week 9 - Session 1 - The Internet, the Web, HTTP