Skip to content

Commit

Permalink
Fixed issue #543 (#586)
Browse files Browse the repository at this point in the history
* Allow optional installation of the 'cryptography' package (#543)

* Update docs (#543)

* Update docs (#543)

* Update docs/getting_started.rst

Co-authored-by: Andrew Chen Wang <[email protected]>

* fix for code-block (#543)

* another fix for code-block (#543)

* fix: removed extra line (#543)

Co-authored-by: Andrew Chen Wang <[email protected]>
  • Loading branch information
armenak-baburyan and Andrew-Chen-Wang authored Jun 6, 2022
1 parent 2cf3269 commit 4b65afb
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
32 changes: 28 additions & 4 deletions docs/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,34 @@ possible.
Installation
------------

Simple JWT can be installed with pip::
Simple JWT can be installed with pip:

.. code-block:: console
pip install djangorestframework-simplejwt
Cryptographic Dependencies (Optional)
-------------------------------------

If you are planning on encoding or decoding tokens using certain digital
signature algorithms (i.e. RSA and ECDSA; visit PyJWT for other algorithms), you will need to install the
cryptography_ library. This can be installed explicitly, or as a required
extra in the ``djangorestframework-simplejwt`` requirement:

.. code-block:: console
pip install djangorestframework-simplejwt[crypto]
The ``djangorestframework-simplejwt[crypto]`` format is recommended in requirements
files in projects using ``Simple JWT``, as a separate ``cryptography`` requirement
line may later be mistaken for an unused requirement and removed.

.. _`cryptography`: https://cryptography.io

Project Configuration
---------------------

Then, your django project must be configured to use the library. In
``settings.py``, add
``rest_framework_simplejwt.authentication.JWTAuthentication`` to the list of
Expand Down Expand Up @@ -59,16 +83,16 @@ allow API users to verify HMAC-signed tokens without having access to your
signing key:

.. code-block:: python
from rest_framework_simplejwt.views import TokenVerifyView
urlpatterns = [
...
path('api/token/verify/', TokenVerifyView.as_view(), name='token_verify'),
...
]
If you wish to use localizations/translations, simply add
If you wish to use localizations/translations, simply add
``rest_framework_simplejwt`` to ``INSTALLED_APPS``.

.. code-block:: python
Expand Down
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
"python-jose": [
"python-jose==3.3.0",
],
"crypto": [
"cryptography>=3.3.1",
],
}

extras_require["dev"] = (
Expand Down

0 comments on commit 4b65afb

Please sign in to comment.