1

I'm trying to create a real time subscription on the Instagram API using R and the httr package but I'm struggling with the PubSubHubbub authentication.

Here's the code I use:

require(httr)
r = POST(url = 'https://api.instagram.com/v1/subscriptions',
     body = "client_id=XXXXX;client_secret=XXXX;aspect=media;access_token=XXXX;callback_url=http://localhost:1410/;object=tag;object_id=selfie",
     encode = "form",
     verbose()
    )
str(content(r))

The error message I'm getting is:

..$ error_message: chr "Invalid URL. The URL may be on a private network."

Now I understand that the Instagram api can't reach http://localhost:1410/, yet, this is the call back url given by the oauth_callback() function from the httr package.

Any help would and guidance be very much appreciated.

Thanks

Stephane
  • 11
  • 1
  • Alternatively, any other method in R that does not specifically require the httr package would also be suitable. – Stephane Feb 12 '15 at 11:01

2 Answers2

2

Instagram does not allow you to use localhost for a callback URL for the obvious reason that it can't POST data to it...

If you need to test out your subscription then you must do so on a publicly accessible server.

Tom Hall
  • 4,258
  • 2
  • 23
  • 23
  • Thanks. But I would assume that I could use a method similar to the oauth2.0_token() which does not require public callback_url? – Stephane Feb 12 '15 at 11:00
0

You could setup a tunnel to your localhost with https://ngrok.com/ or something similar and use the generated live-url.