Instagram实时OAuthParameterException:缺lessclient_id或access_tokenurl参数。 在_request

我试图build立Instagram实时订阅。 我是NodeJS的新手,所以想从GitHub设置项目。 我已经尝试了几个回购,他们都结束了同样的错误。

OAuthParameterException occurred: Missing client_id or access_token URL parameter. in _request 

我目前使用的代码来自: https : //github.com/weblancaster/instagram-real-time

我开始注册我的应用程序,我为我的callbackurl设置了一个heroku实例,获得了范围为public_content和follower_list的access_token。

在server.js中 ,我使用从https://www.instagram.com/developer/clients/manage/获取的client_id和client_secret值replace了YOUR_CLIENT_ID和YOUR_CLIENT_SECRET。此外,我为access_token添加了值,因为文档状态

Instagram API需要来自每个端点的已authentication用户的access_token。 我们不再支持仅使用client_id发出请求。

接下来我尝试订阅一个标签(第38-45行)。 这会导致错误消息

 OAuthParameterException occurred: Missing client_id or access_token URL parameter. in _request 

尝试解决错误:

如这里所build议的,我在Instagram-node-lib / lib / class.instagram.js中添加了以下代码行。 这并没有解决这个错误。

 options['headers']['Content-Type'] = 'application/x-www-form-urlencoded'; 

我修改了Instagram-node-lib / lib / class.instagram.subscription.js中的订阅function以包含verify_token。 这也没有解决这个错误。

 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); }; 

上面的Instagram-node-lib中的2个改变是使用编译的

 install npm --save https://github.com/zunman/instagram-node-lib/tarball/master 

我更新版本的node,nom,instagram-node-lib的package.json如下。

 { "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" } } 

我不知道我错过了什么。 任何帮助与错误是非常感激。

PS我也遇到了与这个项目同样的错误。

Instagram API不再支持标签订阅: https : //www.instagram.com/developer/changelog/

在2015年11月17日或之后创build的应用程序

  • 弃用实时订阅标签,位置和地理位置

不知道为什么他们这样做,但即使你摆脱了这个错误,你将不会收到标签更新。

我正在尝试相同的事情,但下面的行实际上为我工作(至less在错误输出,因为没有任何事情通知我的应用程序):

 options['headers']['Content-Type'] = 'application/x-www-form-urlencoded'; 

你可以用“最近的媒体标签”端点( https://www.instagram.com/developer/endpoints/tags/#get_tags_media_recent ),使用定时器或你的应用程序中的某些东西,并不时进行search。 不是最好的世界,但应该工作。