获取Facebook用户的UserId

时间:2016-10-12 19:35:20

标签: javascript facebook-graph-api facebook-javascript-sdk

我有一个片段,我允许我的MVC Asp.net网站上的用户发布POST。它工作正常。

我需要的是发布POST并且facebook用户点击它(如果用户点击它,会有一个url动作将你带到mywebsite)。我如何获得userId或XXXX facebook用户点击的东西?

一旦我的网站上的用户发布此帖子,朋友可以点击该链接,我想知道用户点击了什么。

    function facebookShare()

    {

        FB.ui({

            method: 'feed',

            name: "My gallery - Price: $49.99",

            link: "https://mygallery.net/Product/Details/99",

            picture: "http://mygallery.com//Images/Products/image.jpg",

            description: "In the last 100 years of....",

            caption: "Product Name: Awesome Pix-X",

            quote:"Quote: You will always be mine!"

        },

 

        function (response)

        {

            if (response && !response.error_message) {

                alert('post_id : ' + response.post_id);

            } else {

                alert('Error while posting.');

            }

 

        });

 

    }

 

那么我在这里添加一个查询参数来动态获取点击它的Facebook用户吗? 链接:“https://mygallery.net/Product/Details/99”,

1 个答案:

答案 0 :(得分:1)

如果用户未授权您的应用,则无法知道。如果他授权您的应用,您可以使用FB.getLoginStatus获取其ID。

相关问题