[Fixed]-It is required that you pass in a value for the "algorithms" argument when calling decode()


You’re missing an ‘s’, the parameter is called "algorithms" in the decode function:

payload = jwt.decode(token, 'secret', algorithms=['HS256'])

and you’re also passing an array of possible values.

When you call encode, the parameter is "algorithm" and only takes a single value.

The reason is that during encoding (i.e signing), you have to use explicitly one algorithm, because a token can only be signed using one algorithm. But during decoding (verifying), you tell the function which algorithms you accept.



I had to pass
verify=False, options={‘verify_signature’: False} in order to get it working.


Another solution is to downgrade the PyJWT version to 1.7.1, so you wouldn’t need to pass the "algorithms" argument.

Like this:

jwt.decode(encoded, verify=False)

Leave a comment