Closed helxsz closed 6 years ago
i used the following code to get some users 's pictures, i am testing https://0be58cff.ngrok.io/users/adorofarm, but it gives me an error :
{ FetchError: invalid json response body at https://api.instagram.com/v1/users/adorofarm?access_token=2959557543.a40649d.b9fe045ad7f24806b1ae196e1de3dd45 reason: Unexpected token < in JSON at position 0 at /Users/xisizhe/Documents/projects/mean-master/node_modules/_node-fetch@2.2.0@node-fetch/lib/index.js:239:32 at at process._tickCallback (internal/process/next_tick.js:188:7) message: 'invalid json response body at https://api.instagram.com/v1/users/adorofarm?access_token=2959557543.a40649d.b9fe045ad7f24806b1ae196e1de3dd45 reason: Unexpected token < in JSON at position 0', type: 'invalid-json' }
how to solve it? this is my code below
app.get("/users/:user_id",async (req, res) => { let user_id = req.params.user_id; console.log('user_id ',user_id); try { const profileData = await instagram.get('users/'+user_id); const media = await instagram.get('users/'+user_id+'/media/recent'); console.log(profileData); res.send({ user: profileData.data, posts: media.data}); } catch (err) { console.log(err); } });
i used the following code to get some users 's pictures, i am testing https://0be58cff.ngrok.io/users/adorofarm, but it gives me an error :
how to solve it? this is my code below