Search code examples
node.jsinstagraminstagram-api

APISubscriptionError instagram API private network


I'm trying set up a instagram subscription on my localhost with the Instagram-node nodeJs API, but when I launch this code I got this error :

{ [Error: APISubscriptionError: Invalid URL. The URL may be on a private network.]
  code: 400,
  error_type: 'APISubscriptionError',
  error_message: 'Invalid URL. The URL may be on a private network.',
  retry: [Function] } undefined

the code :

var express = require('express');
var app = express();
var api = require('instagram-node').instagram();

api.use({access_token : 'xxxxxxxxxxxxxxx'})
api.use({
client_id:'xxxxxxxxxx',
client_secret:'xxxxxxxxxxxxx'

});

var redirect_uri = 'http://127.0.0.1:3000/callback';


api.add_geography_subscription(48.565464564, 2.34656589, 100, 'http://127.0.0.1:3000/callback',
    {}, 
    function(err, result, remaining, limit){
        console.log(err,result)

});

app.listen(3000);

Any ideas ?


Solution

  • Instagram or anybody esle cannot access your localhost or 127.0.0.1 as this IP address is just known and accessible on your computer itself. You have to register the callback on a public IP address or domain and host your application there.