尝试使用 auth_code 流程获取访问令牌时,出现以下错误:{'error': 'invalid_grant', 'error_description': 'authentication failure'} 这是我使用 python 的请求 https://mysalesforceurl.my.salesforce.com/services/oauth2/token
data = {
"grant_type": "authorization_code",
"redirect_uri": redirect_uri,
"code": auth_code,
"code_verifier": code_verifier,
"client_id": SALESFORCE_CLIENT_ID,
"client_secret": SALESFORCE_CLIENT_SECRET
}
headers = {
"Authorization": f"Basic {auth_header}",
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(token_url, data=data, headers=headers)
我见过很多人有类似的错误,但没有人使用身份验证代码流程。我已经选择了“允许用户自我验证”并放宽了我的应用程序中的 IP 限制。 还有其他建议吗?
我找不到任何与此相关的文档,因此只是通过使用不同的值进行测试来解决。