我正在尝试将 YELP API 集成到 Android Studio 的应用程序中。我正在尝试使用 Postman 中的发布请求获取访问 token 。但是,当我发送 post 请求时,我收到以 JSON 格式返回的错误:
{
"error": {
"code": "VALIDATION_ERROR",
"description": "'client_credentials' is not one of ['authorization_code', 'refresh_token']",
"field": "grant_type",
"instance": "client_credentials"
}
}
我已经在这个网站和谷歌上搜索了描述行的具体含义:
"description": "'client_credentials' is not one of ['authorization_code', 'refresh_token']",
我无法找到任何关于此错误含义的结果。这是我在 postman 中的项目设置:
我只是从 yelp 复制并粘贴我的客户端 ID 和 API key ,并将它们分别存储在 Postman 的 client_id 和 client_secret 中。当我发送此请求时,我收到 400 Bad Request 错误并发现它是验证错误。起初我以为我输入了错误的 API key ,但是,我刷新了 API key 并直接复制并粘贴了它,所以我确信我的 API key 和客户端 ID 是正确的。输出应如下所示,并且应提供访问 token :
我找不到任何包含此特定错误消息的示例。
最佳答案
您不再需要刷新 token ,您所需要的只是授权 header 中的 API key :
Authorization: Bearer {{apiKey}}
来源:https://www.yelp.com/developers/documentation/v3/authentication
关于java - Yelp Android 工作室 VALIDATION_ERROR,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52951828/