Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instagram returning HTML instead of JSON #6

Open
davidwkaiser opened this issue Mar 28, 2017 · 3 comments
Open

Instagram returning HTML instead of JSON #6

davidwkaiser opened this issue Mar 28, 2017 · 3 comments

Comments

@davidwkaiser
Copy link

When I run the app ,whether from my code base or from a clone, the app fails to authenticate at IG, giving this error:

{ SyntaxError: Unexpected token < in JSON at position 0
at Object.parse (native)
at IncomingMessage. (/Users/test/Desktop/simple_node_app/node_modules/instagram-node/lib/instagram.js:192:27)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
retry: [Function: retry],
status_code: 404,
etc, etc...

I tested the token with an API call from the browser, it works when it is standalone, but the server.js file keeps throwing this error. It does not matter whether I use client_id and client_secret or not. I also tried using a variety of different API calls, just in case the paths had changed, no effect. I have been banging my head on this for a while, my gut feel is that it's something to do with versions, but I haven't found it yet.

Here are my versions:

"dependencies": {
"ejs": "^2.5.6",
"express": "^4.15.2",
"instagram-node": "^0.5.8"
},

@davidwkaiser davidwkaiser changed the title Fairly to authenticate using token Failing to authenticate using token Mar 28, 2017
@davidwkaiser
Copy link
Author

OK, I've been working this some more. The problem seems to be that IG is returning an HTML file, not a JSON object.

When I use this URL, I get JSON in return:
https://api.instagram.com/v1/users/self/media/recent/?access_token=12345

but when the server makes a call using the instagram-node library, I get an HTML file, which yields the above error

@davidwkaiser davidwkaiser changed the title Failing to authenticate using token Instagram returning HTML instead of JSON Mar 30, 2017
@valentimmx
Copy link

@davidwkaiser did you find a way to solve this issue?

I'm taking too..

@davidwkaiser
Copy link
Author

I have not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants