Skip to main content

Logout users when the passwords changed in REST API

Project description

Django Auth Protection

Django Auth Protection This package logout users from the system by changing the password in REST API.


Why Django Auth Protection?

Simple JWT provides a JSON Web Token authentication backend for the Django REST Framework. It aims to cover the most common use cases of JWTs by offering a conservative set of default features. It also aims to be easily extensible in case a desired feature is not present. But one of the problems is that when the users change the password, they can continue to work on the system with the previous token until it expires. This package overrides the Simple JWT to solve this problem.


How to use it


  • Download and install latest version of Django Auth Protection:
$ pip install django-auth-protection
# or
$ easy_install django-auth-protection

Then you have to create a custom TokenObtainPairView class and change the serializer_class to ProtectTokenObtainPairSerializer (follow the sample):

  • Make a custom TokenObtainPairView and change the serializer_class:
from auth_protection.serializers import ProtectTokenObtainPairSerializer


class CustomTokenObtainPairView(TokenObtainPairView):

    serializer_class = ProtectTokenObtainPairSerializer
  • Change All authentication_classes on your views and replace it with JWTAuthProtection:
from auth_protection.authentications import JWTAuthProtection


class SampleView(TARGET_VIEW):
    authentication_classes = [JWTAuthProtection]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-auth-protection-1.0.3.tar.gz (4.9 kB view hashes)

Uploaded Source

Built Distribution

django_auth_protection-1.0.3-py3-none-any.whl (5.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page