diff --git a/docs/getting_started.rst b/docs/getting_started.rst index 8e961d34d..c07382414 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -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 @@ -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 diff --git a/setup.py b/setup.py index 5687b6604..b99a707c7 100755 --- a/setup.py +++ b/setup.py @@ -30,6 +30,9 @@ "python-jose": [ "python-jose==3.3.0", ], + "crypto": [ + "cryptography>=3.3.1", + ], } extras_require["dev"] = (