|
1 | 1 | Configuration Options |
2 | 2 | ===================== |
3 | 3 |
|
4 | | -.. literalinclude:: ../flask_jwt_extended/config.py |
5 | | - :language: python |
| 4 | +You can change many options for how this extension works via |
6 | 5 |
|
7 | | -.. .. automodule:: flask_jwt_extended.config |
8 | | -.. :members: |
| 6 | +.. code-block:: python |
| 7 | +
|
| 8 | + app.config[OPTION_NAME] = new_options |
| 9 | +
|
| 10 | +The available options are: |
| 11 | + |
| 12 | +.. tabularcolumns:: |p{6.5cm}|p{8.5cm}| |
| 13 | +================================= ========================================= |
| 14 | +``JWT_TOKEN_LOCATION`` Where to find the JWT in the request. The options are ``'headers'`` or |
| 15 | + ``'cookies'``. Defaults to ``'headers'`` |
| 16 | +``JWT_HEADER_NAME`` What header to look for the JWT in a request. Only has an effect if |
| 17 | + JWT_TOKEN_LOCATION is 'headers'. Defaults to ``'Authorization'`` |
| 18 | +``JWT_HEADER_TYPE`` What type of header the JWT is in. Defaults to ``'Bearer'``. This can be |
| 19 | + an empty string, in which case the header only contains the JWT |
| 20 | +``JWT_COOKIE_CSRF_PROTECT`` Enable/disable CSRF protection when using 'cookies' as the JWT_TOKEN_LOCATION. |
| 21 | + This has no affect if using 'headers' as the JWT_TOKEN_LOCATION |
| 22 | +``JWT_ACCESS_CSRF_COOKIE_NAME`` Name of the CSRF access cookie. Defaults to ``'csrf_access_token'``. Only used |
| 23 | + if using cookies with CSRF protection enabled |
| 24 | +``JWT_REFRESH_CSRF_COOKIE_NAME`` Name of the CSRF refresh cookie. Defaults to ``'csrf_refresh_token'``. Only used |
| 25 | + if using cookies with CSRF protection enabled |
| 26 | +``JWT_CSRF_HEADER_NAME`` Name of the header that we will look for the CSRF double submit token in. |
| 27 | + Defaults to ``X-CSRF-TOKEN``. Only used if using cookies with CSRF protection enabled |
| 28 | +``JWT_ACCESS_TOKEN_EXPIRES`` How long an access token should live before it expires. This takes a |
| 29 | + ``datetime.timedelta``, and defaults to 15 minutes |
| 30 | +``JWT_REFRESH_TOKEN_EXPIRES`` How long a refresh token should live before it expires. This takes a |
| 31 | + ``datetime.timedelta``, and defaults to 30 days |
| 32 | +``JWT_ALGORITHM`` Which algorithm to sign the JWT with. `See here |
| 33 | + <https://pyjwt.readthedocs.io/en/latest/algorithms.html>`_ for the options. Defaults |
| 34 | + to ``'HS256'``. Note that Asymmetric (Public-key) Algorithms are not currently supported. |
| 35 | +``JWT_BLACKLIST_ENABLED`` Enable/disable token blackliting and revoking. Defaults to ``False`` |
| 36 | +``JWT_BLACKLIST_STORE`` Where to save revoked tokens. `See here |
| 37 | + <http://pythonhosted.org/simplekv/>`_ for options. |
| 38 | +``JWT_BLACKLIST_CHECKS`` What token types to check against the blacklist. Options are |
| 39 | + ``'refresh'`` or ``'all'``. Defaults to ``'refresh'`` |
| 40 | +================================= ========================================= |
0 commit comments