Search code examples
javaandroidpostmanyelpyelp-fusion-api

Yelp android studio VALIDATION_ERROR


I am trying to integrate the YELP API within an application in Android Studio. I am trying to acquire an access token using a post request in Postman. However, when I send the post request I get this error returned in JSON format:

{
"error": {
    "code": "VALIDATION_ERROR",
    "description": "'client_credentials' is not one of ['authorization_code', 'refresh_token']",
    "field": "grant_type",
    "instance": "client_credentials"
   }
}

I have searched this site and google for what the description line means in particular:

"description": "'client_credentials' is not one of ['authorization_code', 'refresh_token']",

I have not been able to find any results as to what this error means. Here is my project setup in postman:

enter image description here

I simply copy and pasted my client ID and API key from yelp and stored them within the client_id and client_secret in Postman respectively. When I send this requestion I get the 400 Bad Request error and find out that its a validation error. At first I thought that I entered the wrong API key, however, I refreshed the API key and directly copy and pasted it, so I am confident that my API key and client ID are correct. The output should look like this and it should deliver an access token:

enter image description here

I couldn't find any examples that had this specific error message.


Solution

  • You no longer need a refresh token, all you need is an API key in your Authorization header:

    Authorization: Bearer {{apiKey}}
    

    Source: https://www.yelp.com/developers/documentation/v3/authentication