我添加到phonegap app Facebook Connect, 它工作正常并生成访问令牌,但当我试图获取userID值时 的 “Undenified” 我的职责:
FB.init({
appId: "************",
nativeInterface:CDV.FB,
xfbml: true,
useCachedDialogs: false,
status: true,
cookie: true,
oauth: true
});
//alert("Init Done");
FB.getLoginStatus(function (response) {
if (response.authResponse) {
if (response.status == 'connected') {
Token = response.authResponse.accessToken;// This one is Good!
userid = response.authResponse.userID;// This one is Bad
}
答案 0 :(得分:1)
我使用以下内容并且工作正常:
FB.api('/me', {}, function (response) {
fbuserid = response.userid;
});
这为您提供了用户数据。您也可以通过范围来获得您想要的电子邮件,用户ID等...
答案 1 :(得分:0)
遍历键以查看存储的内容
for (var key in response.authResponse) {
console.log(key);
console.log(response.authResponse[key]);
}