Skip to content

Commit c4a4fb6

Browse files
acdebacajpadilla
authored andcommitted
Added section to usage docs for jwt.get_unverified_header() (jpadilla#350)
1 parent aed7305 commit c4a4fb6

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

docs/usage.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,20 @@ the integrity or authenticity of the claimset cannot be trusted.
5151
>>jwt.decode(encoded, verify=False)
5252
{u'some': u'payload'}
5353
54+
Reading Headers without Validation
55+
----------------------------------
56+
57+
Some APIs require you to read a JWT header without validation. For example,
58+
in situations where the token issuer uses multiple keys and you have no
59+
way of knowing in advance which one of the issuer's public keys or shared
60+
secrets to use for validation, the issuer may include an identifier for the
61+
key in the header.
62+
63+
.. code-block:: python
64+
65+
>>jwt.get_unverified_header(encoded)
66+
{u'alg': u'RS256', u'typ': u'JWT', u'kid': u'key-id-12345...'}
67+
5468
Registered Claim Names
5569
----------------------
5670

0 commit comments

Comments
 (0)