Trying to grab an access token using the client credentials flow in Python. Getting a 401 back even though the client ID and secret are correct.
import requests
url = "https://api.mypurecloud.com/oauth/token"
data = {
"grant_type": "client_credentials",
"client_id": "MY_ID",
"client_secret": "MY_SECRET"
}
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(url, data=data, headers=headers)
print(response.status_code, response.text)
Docs say this should work. What’s wrong?