sharataka
sharataka

Reputation: 5132

Why is there a difference in the Facebook user Id returned?

I'm using the Facebook SDK to implement login.

// Here we run a very simple test of the Graph API after login is
// successful.  See statusChangeCallback() for when this call is made.
function testAPI() {
    console.log('Welcome!  Fetching your information.... ');
    FB.api('/me', function(response) {
      console.log('Successful login for: ' + response.name);
      console.log(response);
      document.getElementById('status').innerHTML =
        'Thanks for logging in, ' + response.name + response.email + response.id + '!';
    });

    FB.api('/me/permissions', function(response) {
      console.log(response);

    });

}

<fb:login-button scope="public_profile,email" onlogin="checkLoginState();">
</fb:login-button>

The item that gets returned from response.id is not the same as my Facebook user ID when I look at the Graph Explorer here: https://developers.facebook.com/tools/explorer?method=GET&path=me%3Ffields%3Did%2Cname%2Cemail&version=v2.5.

Why is that?

Upvotes: 0

Views: 453

Answers (1)

andyrandy
andyrandy

Reputation: 73984

You probably selected the "Graph Explorer" App in the API Explorer. Select your own app in the dropdown and you will get the same ID. It´s an "App Scoped ID". See the changelog for v2.0 to find out about those: https://developers.facebook.com/docs/apps/changelog#v2_0

Upvotes: 2

Related Questions