我使用Facebook SDK实现登录。
// 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>
当我在这里查看Graph Explorer时,从response.id返回的项目与我的Facebook用户ID不同:https://developers.facebook.com/tools/explorer?method=GET&path=me%3Ffields%3Did%2Cname%2Cemail&version=v2.5。
为什么?
答案 0 :(得分:2)
您可能在API Explorer中选择了“Graph Explorer”应用程序。在下拉列表中选择您自己的应用,您将获得相同的ID。这是一个“App Scoped ID”。请参阅v2.0的更改日志以了解这些内容:https://developers.facebook.com/docs/apps/changelog#v2_0