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?