pennersr / django-allauth

Integrated set of Django applications addressing authentication, registration, account management as well as 3rd party (social) account authentication.
https://allauth.org
MIT License
9.5k stars 3.03k forks source link

module 'jwt' has no attribute 'PyJWTError' #3873

Closed aidar-aminev closed 4 months ago

aidar-aminev commented 4 months ago

module 'jwt' has no attribute 'PyJWTError'

pennersr commented 4 months ago

What happens when you open a python shell and run:

>>> import jwt
import jwt
>>> jwt.__version__
jwt.__version__
'2.8.0'
>>> jwt.PyJWTError
jwt.PyJWTError
<class 'jwt.exceptions.PyJWTError'>
krystofbe commented 4 months ago

I encountered a similar issue where I received the error module 'jwt' has no attribute 'PyJWTError'. After investigating, I found that the problem was due to having the jwt package installed instead of pyjwt.

Django Allauth requires the pyjwt package. To resolve this, I removed the jwt package and installed pyjwt:

pip uninstall jwt
pip install pyjwt

After making this change, the issue was resolved, and Django Allauth worked as expected.