Skip to content

Commit

Permalink
Add documentation on how to use the require option
Browse files Browse the repository at this point in the history
  • Loading branch information
psafont committed Nov 26, 2019
1 parent 791efde commit 2130d36
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,13 @@ Issued At Claim (iat)
jwt.encode({'iat': 1371720939}, 'secret')
jwt.encode({'iat': datetime.utcnow()}, 'secret')
Requiring Presence of Claims
----------------------------

If you wish to require one or more claims to be present in the claimset, you can set the ``require`` paramenter to include these claims.

.. code-block:: python
>>jwt.decode(encoded, options={'require': ['exp', 'iss', 'sub']})
{u'exp': 1371720939, u'iss': u'urn:foo', u'sub': u'25c37522-f148-4cbf-8ee6-c4a9718dd0af'}

0 comments on commit 2130d36

Please sign in to comment.