Node.js Instagram APISubscriptionError

Dan*_*Dan 8 node.js instagram

我正在使用instagram节点模块(在这里找到:GitHub上的instagram-node ).

我理解,在发出订阅请求时,Instagram会立即向传递的回调发送GET请求.我使用浏览器和Instagram自己的例子测试了我的GET端点:

http://your-callback.com/url/?hub.mode=subscribe&hub.challenge=15f7d1a91c1f40f8a748fd134752feb3&hub.verify_token=myVerifyToken
Run Code Online (Sandbox Code Playgroud)

......它运作得很好; 我正在记录req.query并在控制台中看到完整的东西并15f7d1a91c1f40f8a748fd134752feb3在浏览器中获得预期的输出.

但是当我向Instagram发出订阅请求时,我仍然......

  1. 在回调端点上看不到任何操作
  2. 收到此错误:

{ [Error: APISubscriptionError: Unable to reach callback URL "http://mydomain.co/geo/".] code: 400, error_type: 'APISubscriptionError', error_message: 'Unable to reach callback URL "http://mydomain.co/geo/".', retry: [Function] }

最令人沮丧的是,这个相同的代码曾经工作过一次......所以我非常怀疑Instagram上有什么东西被抬起......太多自我吸收的少年小鸡张贴镜像自拍,也许?

什么想法可能是错的? - 谢谢!

var express = require("express"),
    app = express(),
    http = require('http'),
    server = http.createServer(app),
    port = 80;

var ig = require('instagram-node').instagram();

ig.use({ client_id: 'xxxxxxxx',
         client_secret: 'yyyyyyyy' });

app.use(express.urlencoded());
app.use(express.json());

app.get('/geo', function(req, res){
    console.log(req.query);
    res.send(req.query['hub.challenge']);
});

app.post('/geo', function(req, res){
    console.log(req);
});

console.log('running subscription');
setTimeout(function(){
    ig.add_geography_subscription(32, -96, 500, 'http://mydomain.co/geo/', function(err, result, limit){
        if(err){ console.log(err); }
        else if(result){ console.log(result); };
    });
},100);

server.listen(port);
Run Code Online (Sandbox Code Playgroud)