科尔多瓦Facebook登录FB.api调用不起作用

汤纳诺

我正在使用cordgap-facebook-plugin进行cordova Facebook登录

在使用以下命令检查用户的登录状态后,我正在使用以下功能 FB.getLoginStatus

function processFacebook(token) {
  FB.api('/me', 'get', {
    access_token: token
  }, function(response) {
    alert(response);
  });
}

但是,我无法收到任何回复。有人可以指出我要去哪里了吗?我把从参考这个,但该方法似乎没有工作。这是原始index.jsindex.html文件的链接

杰伊·拉索德(Jay Rathod RJ)

试试这个东西。

获取访问令牌。

var fbLoginSuccess = function (userData) {
        alert("UserInfo: ", userData);
        facebookConnectPlugin.getAccessToken(function(token) {
        alert("Token: " + token);
    });
}

获取用户个人资料数据。

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))
        });
}

It will give you all the Relevant details of User Profile.

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章