Can't fetch bearer token

Hi, I am trying to send a request to Zoom API. I can retrieve my bearer token but when I use it to Zoom API, I am getting an error: {“code”:124,“message”:“This API does not support client credentials for authorization.”}. I tried to change the grant_type to account_credentials but I am getting this error when fetching the token {“reason”:“unsupported grant type”,“error”:“unsupported_grant_type”}.

This is my code:
def fetch_bearer_token():
client_id = os.getenv(“ZOOM_CLIENT_ID”)
client_secret = os.getenv(“ZOOM_CLIENT_SECRET”)

if not client_id or not client_secret:
    raise ValueError("Client ID and Client Secret must be set in environment variables.")

credentials = base64.b64encode(f"{client_id}:{client_secret}".encode()).decode()
token_url = "https://zoom.us/oauth/token"
headers = {
    'Authorization': f'Basic {credentials}',
    'Content-Type': 'application/x-www-form-urlencoded',
}
payload = {
    'grant_type': 'account_credentials'
}

response = requests.post(token_url, headers=headers, data=payload)
if response.status_code == 200:
    return response.json()['access_token']
else:
    raise Exception(f"Error fetching bearer token: {response.text}")

How can I fix this? Is it possible to get the token without a redirect_url?

@maisum are you doing this over python?