Closed Diwura closed 1 year ago
You are probably not doing things the intended way. Please provide at least a MRE
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days
If you using a django app with a newer version of pyJWT it does not need the utf-8 to decode in newer version.
from:
def jwt_encode(payload, context=None): return jwt.encode( payload, jwt_settings.JWT_SECRET_KEY, jwt_settings.JWT_ALGORITHM, ).decode('utf-8')
to
def jwt_encode(payload, context=None): return jwt.encode( payload, jwt_settings.JWT_SECRET_KEY, jwt_settings.JWT_ALGORITHM, )
file should be in .venv you create for project. example
cd /path/to/your/project/venv/lib/python3.12/site-packages/graphql_jwt
Summary.
Expected Result
the .decode method should return a value after using jwt.encode to encode the payload. What you expected.
Actual Result
Attribute error: 'str' object has no attribute 'decode' What happened instead. Attribute error: 'str' object has no attribute 'decode'
Reproduction Steps
work around involved using a lower version specifically 1.7.1
System Information
This command is only available on PyJWT v1.6.3 and greater. Otherwise, please provide some basic information about your system.