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(“.”).


When building the JWT, there are three inputs.

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