Dagm Fekadu
Dagm Fekadu

Reputation: 610

JS SDK facebook API pass access token

    $scope.getProfilePicture_180=function(token){
  var res={};
      Facebook.api(
            '/me',
            'GET',
            {"fields":"picture.width(180).height(180),name,last_name,middle_name","access_token":token},
            function (response) {
                res=response;
            }
          );
      return res;
      }

In the contrary this is following code works for me,What I can't do is use the above "Fields " thing

                         Facebook.api('/me?access_token='+accessToken, function(response) {
                         $scope.bigData=response;

                      });

for this js code,Passing the access token is not working what is the right way to pass access token to a facebook api call on the above function

Upvotes: 0

Views: 512

Answers (1)

andyrandy
andyrandy

Reputation: 74004

One point of using an SDK is that you do not need to worry about the Access Token. After authorization, the Token will get used anyway, so you can just try this instead:

FB.api(
    '/me',
    {fields: 'picture.width(180).height(180),name,last_name,middle_name'},
    function (response) {
        ...
    }
);

Upvotes: 1

Related Questions