cordova facebook登录FB.api调用不工作 [英] cordova facebook login FB.api call not working
本文介绍了cordova facebook登录FB.api调用不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用cordova Facebook登录,使用 phonegap-facebook-plugin ,
I am working on cordova facebook login, with the phonegap-facebook-plugin,
我在使用 FB.getLoginStatus
function processFacebook(token) {
FB.api('/me', 'get', {
access_token: token
}, function(response) {
alert(response);
});
}
但我无法收到任何回应。
任何人都可以指出我在哪里错了?
我从这,但方法似乎不工作。
以下是原始索引的链接.js 和 index.html file
but, I am unable to receive any response. Can anybody point out where I am going wrong? I took the reference from this , but the method seems not to work. Here's the link to the original index.js and index.html file
推荐答案
尝试此项。
获取访问令牌。
var fbLoginSuccess = function (userData) {
alert("UserInfo: ", userData);
facebookConnectPlugin.getAccessToken(function(token) {
alert("Token: " + token);
});
}
获取用户个人资料数据
Get user Profile data.
var fbLogin = function() {
facebookConnectPlugin.login(["public_profile", "email", "user_birthday", "user_location"],
function(response) {
console.log("Login Response :" + JSON.stringify(response));
//alert("Login Response :" + JSON.stringify(response))
this.authId = response.authResponse.userID;
if (response.status == "connected") {
facebookConnectPlugin.api("/" + response.authResponse.userID, ["public_profile", "email", "user_birthday", "user_location"],
function(result) {
this.email = result.email;
this.firstname = result.first_name;
this.lastname = result.last_name;
this.birthdate = result.birthday;
this.city = result.location.name;
},
function(error) {
alert("Failed: " + error);
});
}
},
function(response) {
alert("Other Response : " + JSON.stringify(response))
});
}
它会给你所有的相关细节。
这篇关于cordova facebook登录FB.api调用不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文