【发布时间】:2015-08-25 17:39:03
【问题描述】:
尝试使用 Node.js 中的 npm 请求库发出 POST 请求,如下所示:
var path = require('path');
var express = require('express');
var request = require('request');
var app = express();
module.exports = app;
var data = {
client_id: 'XXX',
client_secret: 'XXX',
object: 'geography',
aspect: 'media',
lat: 35.657872,
lng: 139.70232,
radius: 1000,
callback_url: 'http://localhost:1337/auth/instagram/callback'
};
var options = {
uri: 'https://api.instagram.com/v1/subscriptions/',
method: 'POST',
form: data
};
request(options,
function (err, response, body) {
console.log(body, "body");
console.log(err, "error");
});
但收到此错误:
{"meta":{"error_type":"APISubscriptionError","code":400,
"error_message":"Invalid URL. The URL may be on a private network."}}
关于如何解决这个问题的任何建议?
非常感谢任何帮助。几天来一直无法设置订阅,并被告知我需要在服务器端而不是客户端进行,所以这就是我现在所处的位置。
【问题讨论】:
-
您在 instagram.com 上的 instagram 应用设置中是否有相同的 url?
http://localhost:1337/auth/instagram/callback? -
@Shiva 是的,我愿意。在客户端设置中,它会询问您网站的 URL,我拥有
http://localhost:1337/和重定向 URI,即http://localhost:1337/auth/instagram/callback以及我在上面放置的callback_url。
标签: javascript node.js instagram instagram-api