I\'m using the php facebook class and put a login button on my page with $f->getLoginUrl(), the problem is this button does not work at first time I click on it.
Have you added the standard FB handlers in your javascript portion? They are supposed to reload the page and set some cookies for the facebook API to work...
<!-- FACEBOOK JAVASCRIPT HANDLER START -->
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId: '%CONTEST_FACEBOOKAPPID%',
cookie: true,
xfbml: true,
oauth: true
});
FB.Event.subscribe('auth.login', function(response) {
window.location.reload();
});
FB.Event.subscribe('auth.logout', function(response) {
window.location.reload();
});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
<!-- FACEBOOK JAVASCRIPT HANDLER END -->