pyjwt icon indicating copy to clipboard operation
pyjwt copied to clipboard

PyJWT does not support all valid JSON types as the payload.

Open teaishealthy opened this issue 1 year ago • 1 comments

PyJWT does not support all valid JSON types as the payload.

Expected Result

strs, ints, floats and lists (even better Sequences) 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"
  }
}

teaishealthy avatar Jul 22 '22 14:07 teaishealthy

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

github-actions[bot] avatar Sep 21 '22 02:09 github-actions[bot]