Skip to content

Commit

Permalink
Add example of the audience param as an iterable
Browse files Browse the repository at this point in the history
Demonstrate to users reading the documentation that the `audience`
parameter is not restricted to the `string` type, but can also accept an
iterable, as implemented in PR#306

jpadilla#306
  • Loading branch information
CorreyL committed Apr 24, 2020
1 parent ddc1dc1 commit 46d1940
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,19 @@ a single case-sensitive string containing a StringOrURI value.
token = jwt.encode(payload, 'secret')
decoded = jwt.decode(token, 'secret', audience='urn:foo', algorithms=['HS256'])
If multiple audiences are accepted, the ``audience`` parameter for
``jwt.decode`` can also be an iterable

.. code-block:: python
payload = {
'some': 'payload',
'aud': 'urn:foo'
}
token = jwt.encode(payload, 'secret')
decoded = jwt.decode(token, 'secret', audience=['urn:foo', 'urn:bar'], algorithms=['HS256'])
The interpretation of audience values is generally application specific.
Use of this claim is OPTIONAL.

Expand Down

0 comments on commit 46d1940

Please sign in to comment.