We have implemented Secure your API using Spring Security 5 and Auth0. But sometimes when we try to deploy the API service or Server Machine restarts, the API Service is failing to deploy because the service is not able to fetch Public Keys using the issue URI and below is the exception we get to see.
org.springframework.security.authentication.AuthenticationServiceException: An error occurred while attempting to decode the Jwt: Couldn't retrieve remote JWK set: org.springframework.web.client.UnknownHttpStatusCodeException: 530 Server Error: "Internal Edge Error"
The error could be Auth0 returning 503 status code with error “Internal Edge Error” instead returning public keys to validate the JWT.
How to avoid this?