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

Solution 1:

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.