NodeJS + Express - getting Instagram JSON data from URL

2960 views node.js

I'm trying to display the JSON data form instagram's URL:

If I put this in browser, it shows the JSON, but I want to be able to get it with express so I can attempt to capture any data I need to with that URL

const express = require("express");
const Instagram = require("node-instagram").default;
const keys = require("./config/keys");
const app = express();
const request = require("request");

app.get("/", (req, res) => {
  const url = "";
  request(url, (err, response, body) => {
    const json = JSON.parse(body);


When I'm trying to deploy this in localhost, I'm getting an error:

SyntaxError: Unexpected end of JSON input

answered question

1 Answer


the url responds wit a 403 (access denied) error. You are not checking for errors in the request (err in your callback).

According to the instagram developer documentation, you need to register your app and authenticate before you can perform the request with Oauth credentials.

posted this

Have an answer?


Please login first before posting an answer.