-
Not sure if I'm doing this correctly. JWT creation ask for a dict or a str for the claims attribute. Which I guess it either loads() the str or stores the dict directly. But when I create a jwt from a serialized token it only returns a str. Is there a way to return either one or the other as default? I'm new to this and I'm still toying with this stuff but in my head I would like to read the serialized token -> validate it's not expired or tampered and then return "sub" data to the client. So far in order to read the sub claim from the token is to loads(token.claims) and then read the "sub" key. Is this the intented procedure or am I missing something? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The jwk.claims storage is a json_encoded string. |
Beta Was this translation helpful? Give feedback.
The jwk.claims storage is a json_encoded string.
You can use jwcrypto.common.json_decode(token.claims) to obtain a proper dict if that is the form you prefer to use.