slinger
slinger

Reputation: 344

ModuleNotFoundError: No module named 'rest_framework_simplejwt.token_blacklistauthentication'

I am experiencing this error caused by the simplejwt framework.

ModuleNotFoundError: No module named 'rest_framework_simplejwt.token_blacklistauthentication'

I want to blacklist used refresh tokens (after refresh). The simplejwt works perfectly but it seems there is an issue caused by 'rest_framework_simplejwt.token_blacklist'

Here are my rest_framework configs:

REST_FRAMEWORK = {
    'DEFAULT_PERMISSION_CLASSES': [
        'rest_framework.permissions.IsAuthenticated', 
     ],
      'DEFAULT_AUTHENTICATION_CLASSES': [
        'rest_framework.authentication.SessionAuthentication',
        'rest_framework_simplejwt.authentication.JWTAuthentication',
    ]
}

Upvotes: 12

Views: 29734

Answers (4)

abdullah hisham
abdullah hisham

Reputation: 137

just write that in tirmanal (pip install djangorestframework-simplejwt)

Upvotes: 3

NegassaB
NegassaB

Reputation: 478

please check if there is a comma right after 'rest_framework_simplejwt.token_blacklist' in your settings.INSTALLED_APPS.

That's probably the reason why the name is 'rest_framework_simplejwt.token_blacklistauthentication' instead of 'rest_framework_simplejwt.token_blacklist'

Upvotes: 4

lam vu Nguyen
lam vu Nguyen

Reputation: 631

have you tried this

pip install --upgrade djangorestframework-simplejwt

my issue is

ModuleNotFoundError: No module named 'rest_framework_simplejwt'

and the error is in version of djangorestframework-simplejwt; or you can readmore at ImportError: Could not import 'rest_framework_simplejwt.authentication.JWTAuthentication'

Upvotes: 12

Jony_23
Jony_23

Reputation: 352

You have to put the 'Blacklist' app in installed apps:

INSTALLED_APPS = ['rest_framework_simplejwt.token_blacklist', ...]

The documentation explain it: Blacklisted app.

Upvotes: 1

Related Questions