Hey John,
I went through the same thing last week! The key is to use the `/v2/auth/token` endpoint with the `client_credentials` grant type. Make sure your `client_id` and `client_secret` are correctly formatted in the request body. I had an issue with whitespace in my secret initially.
Here's a quick snippet in Python:
import requests
url = "https://api.example.com/v2/auth/token"
payload = {
"grant_type": "client_credentials",
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET"
}
headers = {
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, data=payload, headers=headers)
if response.status_code == 200:
token_data = response.json()
access_token = token_data["access_token"]
print("Successfully obtained access token:", access_token)
else:
print("Error obtaining token:", response.text)
Let me know if that helps!