I have a Flask app that is protected by an Auth0 authentication layer. It has been deployed in production for a few years and so I know that the underlying code works.
This morning while trying to develop on the local instance of the app have experienced extremely slow responses from the Management API. See code below.
# Establish connection to default Auth0 domain
conn = http.client.HTTPSConnection('my-site.auth0.com')
# Send POST request to obtain access token
payload = json.dumps(
dict(client_id = env.AUTH0_CLIENT_ID,
client_secret = env.AUTH0_CLIENT_SECRET,
audience = 'https://my-site.auth0.com/api/v2/',
grant_type = 'client_credentials'
)
)
headers = {'content-type': "application/json"}
conn.request("POST", "/oauth/token", payload, headers) # This request takes up to 5 minutes
# Parse response
res = conn.getresponse()
byte_str = res.read()
return json.loads(byte_str.decode('utf-8'))
Interestingly, I only experience these slowdowns on the local server (the response times on the local server seem to be normal). Is anyone else experiencing similar issues or have you in the past?
We had a brief outage yesterday but I don’t think it would have affected this. What length of response times are you seeing? Are you still experiencing it?
I am seeing localhost response times of 4 minutes and 22 seconds. This has been happening for a few hours, and it appears to just be my environment. Perhaps there is some rate limit in place for my calls? I don’t know why, but only thing I could think…
The Management API response times seem to have spontaneously returned to normal speeds, ~72 hours after the degraded performance started. I didn’t make any permanent changes to the underlying code. The only step I took was to temporarily disable the @wraps function that makes the call to the Management API to verify users credentials before a route is served. App performance was restored to normal. Then, when I added the Management API calls back into the server routes it continued to work well. I wish I had a better answer to give.
If it is only happening in your local environment then it is unlikely to be the result of degraded performance. If you are being rate limited you will receive a rate limit error.