pyjwt
pyjwt copied to clipboard
PyJWT does not support all valid JSON types as the payload.
PyJWT does not support all valid JSON types as the payload.
Expected Result
str
s, int
s, float
s and list
s (even better Sequence
s) should be able to encoded in the payload of the JWT as they are valid JSON types (string, number, object and array)
Actual Result
Raises TypeError: Expecting a mapping object, as JWT only supports JSON objects as payloads.
Reproduction Steps
import jwt
jwt.encode(123, "secret", algorithm="HS256")
System Information
{
"cryptography": {
"version": ""
},
"implementation": {
"name": "CPython",
"version": "3.10.4"
},
"platform": {
"release": "5.10.16.3-microsoft-standard-WSL2",
"system": "Linux"
},
"pyjwt": {
"version": "2.4.0"
}
}
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