Trying to script a simple auth flow using Python requests for our Sydney region tenant. I’m hitting the standard token endpoint with the client credentials grant type, but I keep getting a 401 Unauthorized. The client ID and secret are definitely correct since they work in Postman, but the Python script fails every time.
Here is the snippet I’m using. Is the header format wrong or am I missing something obvious with the region-specific endpoint?
import requests
url = "https://api.us.genesys.cloud/oauth/token"
data = {"grant_type": "client_credentials"}
headers = {"Content-Type": "application/x-www-form-urlencoded"}
auth = (client_id, client_secret)
response = requests.post(url, data=data, headers=headers, auth=auth)
print(response.status_code)