CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead
Asked Answered
M

2

5
INFO:Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit) 
INFO:Started reloader process [27528] using statreload
C:Python\Python39\lib\site-packages\jose\backends\cryptography_backend.py:18:
CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes 
instead from cryptography.utils import int_from_bytes, int_to_bytes 
INFO: Started server process [8912]
INFO: Waiting for application startup. 
INFO: Application startup complete.

I am new to FastAPI as I was implementing the JWT token in my project the APIs are working as it should be, but each time I start the server it shows this warning.

I have imported jwt from jose and CryptContext from passlib.context python version 3.9

I really love to know what is the reason behind this!

Malisamalison answered 3/5, 2021 at 13:57 Comment(0)
B
3

The deprecation warning is caused by how the python-jose library loads the integer values from bytes. This is not related to fastapi, but is an issue in the library you're using. However, the issue was fixed in python-jose five days ago (2021-04-29), and will be present in the next release.

You can see the change in the commit on Github. For now you can ignore the warning, but as soon as an upgraded version of python-jose is released you should upgrade to the new version.

Blenheim answered 4/5, 2021 at 8:47 Comment(0)
G
3

Try to upgrade cryptography package to the newest available version

python3 -m pip install -U cryptography
Granadilla answered 12/7, 2022 at 13:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.