我正在尝试使用talkdesk Reporting API。无论凭据是否正确,它都会给我 401。我正在关注此文档: https ://docs.talkdesk.com/docs/client-credentials 并且我有以下凭据:
id='XXXXXXX'
secret='XXXXXXX'
public_key='XXXXXXX'
algorithm='XXXXXXX'
private_key='XXXXXXX'
key_id ='XXXXXXX'
import requests
consumer_key = key_id
consumer_secret = secret
username = "XXXX"
password = "XXXXX"
payload = {
'grant_type': 'password',
'client_id': consumer_key,
'client_secret': consumer_secret,
'username': username,
'password': password,
'scope':'reports:read'
}
r = requests.post("https://xxx.talkdeskid.com/oauth/token", headers={"Content-Type":"application/x-www-form-urlencoded"}, data=payload)
print(r.content)