JWTClaims types seem wrong #538
Replies: 1 comment 1 reply
-
I just posted the same on StackOverflow under the Thank you! |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I have been exploring the Authlib package since a couple of days now. I am trying to replicate the usual JWT authentication flow and experimenting with the
encode()
anddecode()
functions of aJsonWebToken
fromauthlib.jose
.The encoding works as expected and am able to generate encoded JWTs with ease, thanks to the great documentation.
I am facing issues with the decoding part of it. Especially, the validation part of it. I am using the
validate()
function for that. I keep seeing the following exception being caught:Upon inspection, I found out that the
validate_exp()
functoin that I use inclaims_options
is checking for the type of the "exp" claim in the_validate_numeric_time()
function and it is specifically checking for the "exp" claim to be of int or float type. This is fine and expected, but theJWTClaims
class instance is resulting in the decoded JWT to have all keys and values of type str and not maintaining the float type of the timestamp of "exp" and other time-related claims. This is causing the above exception to be raised.I am posting below some of the code I have tried so that it can be replicated if needed:
I am doing some basic
print
-based debugging as follows:The resulting output for the above print statements is as follows:
Beta Was this translation helpful? Give feedback.
All reactions