Reputation: 445
I have added a facebook like button to my website. I am able to see a like button on the webiste. However when I click the like button, the like count increases but I receive a 401 authorisation required error in the pop up.
On reading facebook documentation further on facebook scrape url. I went to Object debugger and debugged the home page of my website. When I clicked the link for scrape url I get this message "document returned no data"
When I clicked the graph api link, I get this as the ouput.
{ "id": "id_nos", "url": "http://sitename.com /", "type": "website", "updated_time": "2014-03-06T04:30:13+0000", "created_time": "2014-03-04T06:58:54+0000", "is_scraped": false }
Can anyone tell me, how I am suppose to handle this error. What steps I will have to take to fix this issue?
Thanks in Advance
Updated the code for like button:
<div class="like-box">
<div class="fb-like"
data-href="<?php echo $poll['short_url']; ?>"
data-send="false"
data-layout="button_count"
data-width="20" data-show-faces="false">
</div></div>
The script is :
(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/en_US/all.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
Update 2:
The site is protected and asks for username and password (Http authentication). Could this be the reason?
Upvotes: 0
Views: 266
Reputation: 328
Facebook needs to access your site in order to retrieve the Open Graph tags. If your site is protected with HTTP authentication Facebook cannot do so, and so like/share operations won't work correctly.
Upvotes: 1