From 06e3398bf56d49b010aeffa110e5f6309e0bc8e9 Mon Sep 17 00:00:00 2001 From: fobiasmog Date: Mon, 10 Mar 2025 11:42:57 +0100 Subject: [PATCH] Fix TYP header documentation --- docs/usage.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/usage.rst b/docs/usage.rst index 48775bec3..e3cfc74b6 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -102,6 +102,18 @@ Specifying Additional Headers 'eyJhbGciOiJIUzI1NiIsImtpZCI6IjIzMDQ5ODE1MWMyMTRiNzg4ZGQ5N2YyMmI4NTQxMGE1IiwidHlwIjoiSldUIn0.eyJzb21lIjoicGF5bG9hZCJ9.0n16c-shKKnw6gervyk1Dge35tvzbzQ_KCV3H3bgoJ0' +By default the ``typ`` is attaching to the headers. In case when you don't need to pass this header to the token, you have to explicitly null it. + +.. code-block:: pycon + + >>> jwt.encode( + ... {"some": "payload"}, + ... "secret", + ... algorithm="HS256", + ... headers={"typ": None}, + ... ) + + Reading the Claimset without Validation ---------------------------------------