I'm trying to access the Yelp fusion API. I am following the documentation and came to this code:
const request = require('request');
// As you can see the common error of there being a whitespace
// in one of these is not the case here
const clientId = 'O<removed>w';
const clientSecret = 'm<removed>r';
const options = {
url: 'https://api.yelp.com/oauth2/token',
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
json: {
'grant_type': 'client_credentials',
'client_id': clientId,
'client_secret': clientSecret
}
};
request(options, (err, res, body) => {
if(err) {
return console.log(err);
}
console.log(body);
});
Using APIGee I am getting a correct response with this exact same call, however on my OVH VPS I am getting this error: (Note that this is from the body variable)
{ error:
{ code: 'VALIDATION_ERROR',
description: 'client_id or client_secret parameters not found. Make sure to provide client_id and client_secret in the body with the application/x-www-form-urlencoded content-type' } }
I believe I am setting up the call correctly. Can anyone point me in the right direction please? Thank you!