semvec/pypi-packages huggingface dataset:
jwt-i2tic 0.2.1
Simple JWT.
License: BSD License

**JWTiTIC**
This library is a simple method for authentication in microservices using JWT

**Requirements**

------------

*  Python (2.7, 3.3, 3.4, 3.5, 3.6)
*  Django (1.8, 1.9, 1.10, 1.11)
*  Django REST Framework (3.1, 3.2, 3.3, 3.4, 3.5, 3.6)


**Installation**

You need djangorestframework-jwt.
<pre>$ pip install djangorestframework-jwt</pre>

Install using pip.
<pre>$ pip install jwti2tic</pre>

Add 'jwtauth' to your INSTALLED_APPS setting.
```
    INSTALLED_APPS = (
        ...
        'jwtauth',
    )
```
 Add 'DEFAULT_AUTHENTICATION_CLASSES' to your REST_FRAMEWORK settings.
```
    REST_FRAMEWORK = {

        'DEFAULT_AUTHENTICATION_CLASSES': (
            'rest_framework.authentication.BasicAuthentication',
            'jwtauth.drfjwtauth.JWTAuthentication'
        )
    }
```
Add 'CUSTOM JWT_PAYLOAD_HANDLER' to your JWT_AUTH settings.
```

JWT_AUTH = {
    'JWT_PAYLOAD_GET_USERNAME_HANDLER': 'jwtauth.utils.jwt_get_user_name_from_payload_handler',
    'JWT_PAYLOAD_GET_USER_ID_HANDLER': 'jwtauth.utils.jwt_get_user_id_from_payload_handler',
}
```

**Usage**

* In your .views import these packages.
```
from rest_framework.authentication import BasicAuthentication, SessionAuthentication
from rest_framework.permissions import IsAuthenticated
from jwtauth.drfjwtauth import JWTAuthentication
```

* Inside your vieset class, add this settings.
```
authentication_classes = (SessionAuthentication, BasicAuthentication, JWTAuthentication)
permission_classes = (IsAuthenticated,)
```