Skip to content

Improve ergonomics or document usage to emulate python-jose/PyJWT #343

Description

@Nathan-Furnal

There's some discussion, for example in python-keycloak,to migrate away from python-jose as it isn't maintained anymore. I think jwcrypto fits the bill but without some extra security knowledge, it's hard to make the jump.

For example, the current way in the above library, to decode a JWT is:

jwt.decode(token, key, algorithms=algorithms, audience=self.client_id, **kwargs)

The public key is provided by keycloak.
If we do something similar (in the API sense, not with correctness in mind) with jwcrypto we get:

jwt.JWT(jwt=token, key=key, algs=algorithms,...)

But this won't work, in this case for example that external public key is not even a JWK object but if we try to convert it (how?) then I could only get JWSInvalidSignature or something similar.

I think it would be an improvement to document how to use jwcrypto in that case and/or provide higher level functions which take the correct steps for a potential user.

Please do tell if this example is bad or unclear.

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions