Ich versuche auf die Yelp-API zuzugreifen. Ich verfolge die documentation und kam zu diesem Code:Yelp Fusion: Ich kann keine Token erhalten
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);
});
Mit Apigee Ich bin eine richtige Antwort mit genau gleichem Anruf bekommen, aber auf meinem OVH VPS ich diese Störung erhalten: (Beachten Sie, dass diese von der ist Körpervariable)
{ 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' } }
Ich glaube, dass ich den Anruf richtig aufstelle. Kann mir bitte jemand in die richtige Richtung zeigen? Vielen Dank!
Schauen Sie sich [hier] (https://stackoverflow.com/questions/9870523/differences-in-application-json-and-application-x-www-form-urlencoded) –
Can Sie überprüfen mit 'Inhaltstyp' in Kleinbuchstaben? – abdulbarik
@abdulbarik Hat nicht funktioniert –