Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

TypeError #21

Closed
ValentinBossi opened this issue Jul 11, 2020 · 4 comments
Closed

TypeError #21

ValentinBossi opened this issue Jul 11, 2020 · 4 comments

Comments

@ValentinBossi
Copy link

When running python3 jwt_tool.py -T or -R i get:

Traceback (most recent call last):
File "jwt_tool.py", line 1393, in
tamperToken(paylDict, headDict, sig)
File "jwt_tool.py", line 761, in tamperToken
comparestamps, expiredtoken = dissectPayl(paylDict, count=True)
File "jwt_tool.py", line 1187, in dissectPayl
elif type(castInput(paylDict[claim][subclaim])) == str:
File "jwt_tool.py", line 91, in castInput
newInput = json.loads(newInput)
File "C:**\AppData\Local\Programs\Python\Python38-32\lib\json_init_.py", line 341, in loads
raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not list

or

Traceback (most recent call last):
File "jwt_tool.py", line 1483, in
rejigToken(headDict, paylDict, sig)
File "jwt_tool.py", line 1280, in rejigToken
comparestamps, expiredtoken = dissectPayl(paylDict)
File "jwt_tool.py", line 1187, in dissectPayl
elif type(castInput(paylDict[claim][subclaim])) == str:
File "jwt_tool.py", line 91, in castInput
newInput = json.loads(newInput)
File "C:**\AppData\Local\Programs\Python\Python38-32\lib\json_init_.py", line 341, in loads
raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not list

@ticarpi
Copy link
Owner

ticarpi commented Jul 11, 2020

Could you provide a sample token that causes this behaviour? Thanks.

@ASoggySandal
Copy link

Hey,
I just ran into this same issue when my jwt contained a nested dict object like:

Payload = {
"context" : {
"user" : {
"name" : "Name"
},
"group" : "Group"
},

Switching line 91 in castInput from
newInput = json.loads(newInput)
to
newInput = json.dumps(newInput)

Fixed the issue. (Not sure if it will break further along from this, but it works for my current use-case).

Hope that helps.

frani added a commit to frani/jwt_tool that referenced this issue Aug 22, 2020
following comments on ticarpi#21 , user @fredsibcald  says that fix the problem
@Acebond
Copy link

Acebond commented Aug 25, 2020

I had the same issue working with a JWT (unfortunately given NDA I cannot share) that had nested JSON and this fixed it.

@ticarpi
Copy link
Owner

ticarpi commented Oct 20, 2020

Thanks all, this should be fixed in v1.3.5

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants