문제

I am trying to get User data(/me) & Friends data(/me/friends) using a function which fires after login through facebook. I am using Javascript SDK

//Getting logged in user data//
function users(callback) {    FB.api('/me?fields=name,first_name,username,birthday,hometown,albums,photos,location,picture.height(100).width(100),cover', function(response) {
        callback(response);

    });
}

//Getting logged in user friends data//
function pic(album_id, callback) {

    FB.api("/" + album_id + "/photos", function(response) {

        callback(response);

    });
}

By using this i am able to access all public data of logged in user, but not able to access data with limited permission(such as my location & Hometown is set to be visible to my friends only).

App dashboard permissions: enter image description here

도움이 되었습니까?

해결책

You can access fields such as hometown,location etc. for an user using the following code, which asks for an authorization when you login to your app using facebook.

FB.login(function(response) {
      }, {
          scope: 'user_location,user_hometown,user_photos,friends_location'
      });
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top