Why is Open Graph Built-In Like not working anymore?

久未见 提交于 2019-12-25 05:09:35

问题


I've created a Facebook App and Open Graph Action "Like" for Object (this might be the global like action for any kind of information).

I just want to get this format on Recent Activity, using a simple Like Button: "USERNAME" likes "OG:TITLE" on APPNAME

Im using this code:

<meta property="fb:app_id" content="**" /> <meta property="og:type" content="article" /> <meta property="og:url" content="**" /> <meta property="og:title" content="**" /> <meta property="og:image" content="**" />

And loading the SDK like this:

<script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/es_LA/all.js#xfbml=1&appId=*******"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));
</script>

It worked for a day and then stopped and die!

I would like to know if theres any kind of fix for this? What should i do, or what could be wrong?

Thanks to everyone for your time!


回答1:


You can use javascript sdk for liking web pages or objects. Here is sample code. Note that you should get accesstoken from user via authorization.

FB.api(
        '/me/og.like',
        'post',
        { 'object': 'http://www.yourwebpage.com/',
        'access_token': 'aaaa'  },
        function(response) {
           if (!response || response.error) {
              alert('you couldnt like.');
           } else {
              alert('you liked it.');
           }
        });



回答2:


Did you use FB debugger to test your link is everything correct? https://developers.facebook.com/tools/debug



来源:https://stackoverflow.com/questions/11315195/why-is-open-graph-built-in-like-not-working-anymore

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!