Here is my github: https://github.com/klukashka/Calendar
I run my code locally with uvicorn main:app --reload
and go to http://127.0.0.1:8000/docs. Then I register and everything works properly (I see a new row in postgres database). After that I want to login but catch such an error.
(a lot of other lines…)
File “/home/klukashka/Calendar/.venv/lib/python3.10/site-packages/fastapi_users/jwt.py”, line 27, in generate_jwt
return jwt.encode(payload, _get_secret_value(secret), algorithm=algorithm)
AttributeError: module ‘jwt’ has no attribute ‘encode’
It seems strange because if you go to page /home/klukashka/Calendar/.venv/lib/python3.10/site-packages/fastapi_users/jwt.py to see code, there is really no method encode and more than that, it imports itself. I have never seen such self-imports. (I understand that people who created fastapi-users must be much cleverer than me, so I wonder what is the reason of such self-imports and why there is no encode method).
So I just want to make login button work the way it should work.
I tried to check my code (if I have missed anything) and database.
Павел Клюкин is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.