Incorrect Python sample code on Client Credentials Flow page

The Python sample code on the Client Credentials Flow page does not work in Python 3.9. The problem is in the first section, on Request Tokens. You have to place the domain in the call to create the connection, like this:

conn = http.client.HTTPSConnection(YOUR_DOMAIN)
# [...]
conn.request("POST", "/oauth/token", payload, headers)

Hi @nk9,

Welcome to the Auth0 Community!

I understand that you have found a scenario where our sample code for the Python example in the Call Your API Using the Client Credentials Flow docs does not work in Python.

I have just tested this myself and can confirm your same observations. Great call out on this! :clap:

I have also checked the documentation for the http.client.HTTPSConnection module, which defines that it should not be empty.

I will inform our Docs Team about getting the sample code corrected.

Please let me know if there’s anything else I can do to help.

Thank you.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.