dorinclisu / fastapi-auth0

FastAPI authentication and authorization using auth0.com
MIT License
229 stars 39 forks source link

URLError Prevents Server Start Due to Network Failure when Fetching JWKS #44

Open OfficialAshish opened 2 weeks ago

OfficialAshish commented 2 weeks ago

When the server cannot connect to the internet, the code fails to fetch the JWKS (JSON Web Key Set) from Auth0, and it raises a URLError with the message <urlopen error [Errno 11001] getaddrinfo failed>. This error prevents the server from starting up, making it impossible to run the application when the network is unavailable or DNS resolution fails. When this network issue occurs, it results in an unhandled exception, causing the server startup to fail completely.

image

spawn-guy commented 1 week ago

will you be so kind to test if this happens with this version of code? https://github.com/dorinclisu/fastapi-auth0/pull/43 i might fix this for PyJWT as the json file is injected in a different way from jose.

also.. what would be the default behaviour when there is no "open" internet on the server and there is a "local" client requesting something with some token? Unauthorized or some other error? it should fail with Auth0UnauthenticatedException