我正在使用 HTTPoison 向 Paypal api 发送请求。这是使用其 api 登录的贝宝文档:https ://developer.paypal.com/docs/log-in-with-paypal/integrate/
当我获得代码并尝试将其交换为访问令牌时,我收到此错误:"{\"error\":\"invalid_client\",\"error_description\":\"Client Authentication failed\"}",
这是 HTTPoison.post!/3 发布请求的方式:
url = "https://api-m.sandbox.paypal.com/v1/oauth2/token"
headers = [
Authorization: "Basic #{ClientID}:#{Secret}"
]
body = "grant_type=authorization_code&code=#{code}"
HTTPoison.post!(url, body, headers)
这显示了astatus_code: 401
和{\"error\":\"invalid_client\",\"error_description\":\"Client Authentication failed\"}",
错误..这个问题如何解决?