node-facebook/facebook-node-sdk

/{user-id}/picture node error

ahmedosama94 opened this issue · 1 comments

I get an error with code JSONPARSE SyntaxError: Unexpected token � in JSON at position 0, when trying to get the node /{user-id}/picture. I may probably be because the response object is given with a data key? I am not sure of course. I am instead using the /{user-id} endpoint with a fields parameter with picture like so: /{user-id}?fields=picture.

Found a solution:

FB.api(
  '4/picture?redirect=false',
  {fields: 'url', redirect: false},
  function(response) {
    console.log(response);
    // Insert your code here
  }
);

This should work.