我正在使用 phonegap facebook 插件和 facebook javascript api。这是我的代码
FB.init({
appId: "xxxxxxxxxxxxxxx",
status: true,
oauth :true,
nativeInterface: CDV.FB,
//channelURL : 'www', // Channel File
cookie: true,
//useCachedDialogs: false,
xfbml: true
});
FB.login(function(response) {
if (response.authResponse) {
alert(response.authResponse.userID); // literally shows three dots
FB.api('/me', function(me){
if (me.id) {
alert(me.id); // this works
}
});
}
}, { scope: "email" });
我可以从 authResponse 获取 accessToken .... 它是一个长字符串。但 userID 字段的字面意思是“...”。我可以通过使用另一个图形 API 调用来获取额外的往返服务器来获取用户的 ID,/me
但这似乎很浪费。