the response is "One or more parameters are missing in request"
franklingu opened this issue · 11 comments
my code
var yelp = require('yelp').createClient({
consumer_key: 'Omitted...',
consumer_secret: 'Omitted...',
token: 'Omitted...',
token_secret: 'Omitted...'
});
yelp.search({term: 'food', location: 'Montreal'}, function(error, data) {
console.log('err: ', error);
console.log('data: ', data);
});
The response
{"error": {"text": "One or more parameters are missing in request", "id": "MISSING_PARAMETER", "field": "oauth_consumer_key"}}
Getting the same error
Weird... did Yelp modify the way they handle auth? This is a non official module. I'm pretty sure it used to work so I'm guessing something's changed on their end?
A fresh clone of master, with my own keys inserted into demo/yelp.js
, works for me:
mittonk-air:~/pg/other/node-yelp (master) $ node demo/yelp.js
null
{ is_claimed: true,
rating: 2.5,
mobile_url: 'http://m.yelp.com/biz/yelp-san-francisco',
rating_img_url: 'http://s3-media4.fl.yelpcdn.com/assets/2/www/img/c7fb9aff59f9/ico/stars/v1/stars_2_half.png',
review_count: 6878,
name: 'Yelp',
@franklingu: I see you aren't using ssl: true
like the demo does. Does your code work if you add that?
Thanks for testing it @mittonk (I don't even know if I still have Yelp API keys). Would be great if someone could write a PR with a mocha based test/index.js
that can reproduce the error.
@franklingu 's code, with node-yelp 0.2.0 properly installed via npm install --save yelp
, works for me. Can't reproduce the failure at my end.
@franklingu : I wonder if you're going through a proxy server that's stripping the headers. Are you still able to reproduce the failure?
@emptyteacup what error are you getting? do you have a var yelp = require('yelp');
somewhere? Also, this is most likely not an issue with this module. I suggest you use http://www.stackoverflow.com for those kinds of questions.
I am getting the exact same problem using this standard code provided by the module (but passing in my keys and tokens)...
// Request API access: http://www.yelp.com/developers/getting_started/api_access
var Yelp = require('yelp');
var yelp = new Yelp({
consumer_key: 'consumer-key',
consumer_secret: 'consumer-secret',
token: 'token',
token_secret: 'token-secret',
});
// See http://www.yelp.com/developers/documentation/v2/search_api
yelp.search({ term: 'food', location: 'Montreal' })
.then(function (data) {
console.log(data);
})
.catch(function (err) {
console.error(err);
});
I get this error
{ statusCode: 400,
data: '{"error": {"text": "One or more parameters are missing in request", "id": "MISSING_PARAMETER", "field": "oauth_token"}}' }
Ok fixed it... for anyone else having this problem, for me it was a problem passing the .env variables in... in node.js, needed require('dotenv').config();
within the custom module I was building! Hope that helps.
@codemzy i am also getting this error - it is not a problem with the .env variables as i am passing them correctly. oauthToken and oauthTokenSecret are returning as undefined in the Yelp object. help!
i've moved on to to yelp-api-v3
since it worked out of the box for me.
for reference my code was almost exactly as above:
// Request API access: http://www.yelp.com/developers/getting_started/api_access
var Yelp = require('yelp');
var yelp = new Yelp({
consumer_key: process.env.YELP_API_CK,
consumer_secret: process.env.YELP_API_CS,
token: process.env.YELP_API_TOKEN,
token_secret: process.env.YELP_API_TS,
});
// See http://www.yelp.com/developers/documentation/v2/search_api
yelp.search({ term: 'food', location: 'Montreal' })
.then(function (data) {
console.log(data);
})
.catch(function (err) {
console.error(err);
});
and i know that my process.env was working right because i set up a console.log. i dont know what went wrong but im not too concerned as this was just for a freecodecamp project. i figure something broke when yelp moved from api v2 to v3 and so just using v3 worked automatically.