Type Error: decode() got unexpected keyword argument ‘verify’

This error is usually comes when we use PyJWT library in our django project for API.

Because TokenBackend.decode passes arbitrary kwargs to jwt.decode, this is caused by jpadilla/pyjwt#657 (which is now forbidden).

(Temporary) fix is to pin PyJWT with pyjwt<2.2 in your requirements.txt.

Note: If your project hosted with AWS Lightsail may be you need to copy your bitnami libraries from local to python.

Run this command :

sudo cp -r /home/bitnami/.local/lib/python3.8/site-packages/* /opt/bitnami/python/lib/python3.8/site-packages/ 

Then restart your server :

sudo service apache2 restart

That is it for today, hope it helps. If you have a better approach to resolve this problem please make a comment in comment section below.

If you like this article, you can buy me a coffee. Thanks!

Type Error: decode() got unexpected keyword argument ‘verify’

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top