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

self.jwks_client.get_signing_key_from_jwt raises uncaught PyJWKClientConnectionError which gets masked as "Token is invalid or expired" #773

Open
sometimescasey opened this issue Dec 12, 2023 · 0 comments

Comments

@sometimescasey
Copy link

macOS Ventura 13.2
Python 3.12

Admittedly this was my fault for forgetting to run Install Certificates.command when I upgraded to Python 3.12, but this error message did throw me off. I spent a while trying to figure out what was wrong with the JWT token, before I was able to find the real issue:

jwt.exceptions.PyJWKClientConnectionError: Fail to fetch data from the url, err: "<urlopen error [SSL: 
CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)>"

The PyJWKClientConnectionError gets thrown here:

image

This ultimately gets caught as a TokenError with the message "Token is invalid or expired", and this is what you'll see in the failed request in Chrome inspector:

image image image

You can eventually find the correct error if you scroll up high enough in the error log or use a debugger, but I figured I would document in case the error message sends anyone else down the wrong rabbit hole.

@sometimescasey sometimescasey changed the title self.jwks_client.get_signing_key_from_jwt raises uncaught PyJWKClientConnectionError which ultimately raises "Token is invalid or expired" TokenError self.jwks_client.get_signing_key_from_jwt raises uncaught PyJWKClientConnectionError which gets masked as "Token is invalid or expired" Dec 12, 2023
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

1 participant