我正在使用phonegap facebook插件和facebook javascript api。这里是我的代码无法从facebook获取用户ID 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
,但这看起来很浪费。
我看到同样的事情。请注意,oauth令牌在回调中有效,但userID字段实际上是“...” – Leopd
是不是通过“response.authResponse.userID”语句获得用户ID? – MSUH
问题并不清楚,我相信我也有同样的问题,所以我要澄清我看到的确切问题的问题。 – Leopd