How to fix the error "JWT method 'encode' does not exist" when trying to mount a base64 for the assertion parameter of an API?
I'm trying to create a base64 to use as an "assertion" parameter in an API call, but I'm getting an error saying that the "encode" method of the JWT does not exist.
I installed using:
pip3 install jwt
Full code
import jwt
private_key = open("C:\\file\\privateKey.pem", "r").read()
payload = {
"iss": "iss",
"aud": "aud",
"scope": "*",
"iat": 1683141898,
"exp": 1683228298
}
signed = jwt.encode(payload, private_key, algorithm='RS256')
print(signed)
Error:
signed = jwt.encode(payload, private_key, algorithm='RS256')
^^^^^^^^^^
AttributeError: module 'jwt' has no attribute 'encode'