对 facebook 的 javascript SDK 感到非常沮丧。
有人可以告诉我为什么会这样(用我的 Facebook 名称发出警报):
FB.getLoginStatus(function(response) {
if (response.authResponse) {
token = response.authResponse.accessToken;
FB.api('/me', function(response) {
console.log(response);
alert('Your name is ' + response.name);
// do something here they are logged in and have given you perms
});
} else {
// no user session available, someone you dont know
}
});
但这会返回错误,“必须使用活动访问令牌来查询有关当前用户的信息。”:
FB.api('/me', function(response) {
console.log(response);
alert('Your name is ' + response.name);
});