JSON Web Token / JWT Raw Implementation in Python3

In this article, we are going to walkthrough a version of the raw implementation of the JWT specification in Python3. For simplicity, we will use the HMAC + SHA256 for the signing algorithm.

Let’s look at the JWT in a functional sense. There are three outputs to the JWT concatenated with a dot(“.”).

{base64_header}.{base64_payload}.{base64_signature}

When building the JWT, there are three inputs.

  • the header describing the token type and the signing algorithm in JSON