Reputation: 118
I'm trying to set up Instagram real-time subscriptions. I'm new to NodeJS so thought to set up project from GitHub. I have tried several repos, they all end up with the same error.
OAuthParameterException occurred: Missing client_id or access_token URL parameter. in _request
I am currently using the code from: https://github.com/weblancaster/instagram-real-time
I started by registering my app, I set up a heroku instance for my callback url, obtained access_token with scope public_content and follower_list.
In server.js, I replaced YOUR_CLIENT_ID and YOUR_CLIENT_SECRET with my client_id and client_secret values obtained from https://www.instagram.com/developer/clients/manage/ Additionally I added value for my access_token, as the documentation states
The Instagram API requires an access_token from authenticated users for each endpoint. We no longer support making requests using just the client_id.
Next I attempt to subscribe a tag (lines 38-45). This results in error message
OAuthParameterException occurred: Missing client_id or access_token URL parameter. in _request
ATTEMPTS TO RESOLVE THE ERROR:
as suggested here, I added the following line of code in Instagram-node-lib/lib/class.instagram.js . This did not resolve the error.
options['headers']['Content-Type'] = 'application/x-www-form-urlencoded';
I modified the subscription function in Instagram-node-lib/lib/class.instagram.subscription.js to include verify_token. This too did not resolve the error.
InstagramSubscriptions.prototype._subscribe = function(params) {
var i, _i, _len, _ref;
params['method'] = "POST";
params['path'] = "/" + this.parent._api_version + "/subscriptions/";
if ((typeof params['callback_url'] === 'undefined' || params['callback_url'] === null) && this.parent._config.callback_url !== null) {
params['callback_url'] = this.parent._config.callback_url;
}
params['post_data'] = {
object: params['object'],
aspect: 'media',
client_id: this.parent._config.client_id,
client_secret: this.parent._config.client_secret,
verify_token: this.parent._config.access_token,
callback_url: params['callback_url']
};
_ref = ['object_id', 'verify_token', 'lat', 'lng', 'radius'];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
i = _ref[_i];
if (params[i] != null) {
params['post_data'][i] = params[i];
}
}
return this.parent._request(params);
};
The 2 changes above in Instagram-node-lib were compiled using
install npm --save https://github.com/zunman/instagram-node-lib/tarball/master
my package.json with updated versions of node, nom, instagram-node-lib is as below.
{
"name": "RealTimeInstagram",
"version": "0.0.1",
"description": "Real time instagram",
"author": "Michael Lancaster",
"dependencies": {
"express": "3.21.2",
"instagram-node-lib": "https://github.com/zunman/instagram-node-lib/tarball/master",
"jade": "1.3.1",
"request": "2.34.0",
"socket.io": "1.7.4"
},
"engines": {
"node": "6.9.1",
"npm": "3.10.8"
}
}
I am not sure what I'm missing. Any help with the error is much appreciated.
P.S. I've encountered the same error with this project aswell.
Upvotes: 1
Views: 545
Reputation: 11
Instagram API no longer supports tags subscription: https://www.instagram.com/developer/changelog/
Apps created on or after Nov 17, 2015
...
Deprecation of Realtime subscriptions for tags, locations and geographies
Not sure why they did it, but even if you get rid of this error, you won't be receiving tags updates.
I was trying the same thing, but the following line actually worked for me (at least regarding the error output, 'cause nothing was ever notified to my app):
options['headers']['Content-Type'] = 'application/x-www-form-urlencoded';
You can probably work around with the "recent media tag" endpoint (https://www.instagram.com/developer/endpoints/tags/#get_tags_media_recent), using a timer or something in your app and making the search from time to time. Not the best world, but should work.
Upvotes: 1