Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Example no longer works with latest version of pyjwt[crypto] #7

Open
nickstelzenmuller opened this issue Jan 6, 2023 · 1 comment

Comments

@nickstelzenmuller
Copy link

I got the error message "The JWK Set did not contain any usable keys" after installing the latest version of pyjwt[crypto] (v2.6.0) .
When I rolled back to pyjwt=2.3, and install the cryptography package separately (v38) this sample project works again.
I haven't narrowed down which version of pyjwt or cryptography actually caused the problem.

@annisat
Copy link

annisat commented Sep 24, 2024

I ran into the similar problem, though my message is jwt.exceptions.DecodeError: Invalid payload string: 'utf-8' codec can't decode byte 0xd6 in position 1: invalid continuation byte.
I seem to have found the issue here. I dug into the decoding process of PyJWT. PyJWT is splitting the JWT with three segments (JWT default), but the token I got has five.
https://community.auth0.com/t/jwt-verifier-exception-com-auth0-jwt-exceptions-jwtdecodeexception-the-token-was-expected-to-have-3-parts-but-got-5/98398

However, I haven't yet figure out how to fix this. Maybe the web frontend should send a different token?

EDIT: I think we should follow this instruction for the right JWT setting.
https://developer.auth0.com/resources/code-samples/full-stack/hello-world/basic-access-control/spa/react-javascript/fastapi-python

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

No branches or pull requests

2 participants