I am trying to put Facebook connect button on the site and once connected display connected username. But for some reason following code goes into some infinite loop during first connection, and then works fine unless I delete this app from my facebook profile which causes freezing again.
Here is a code on FB connect button click:
FB.Connect.requireSession();
Here is code directly on the page:
<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US" type="text/javascript"></script>
<script type="text/javascript">
FB.init("123", "/xd_receiver.htm");
FB.ensureInit(function() {
FB.Connect.ifUserConnected(function() {
FB.Facebook.apiClient.users_getInfo(new Array(FB.Connect.get_loggedInUser()),new Array("name"), function(user, exec) {
console.log("logged in:"+user[0].name);
});
}, function(){
console.log("guest");
});
});
</script>
If I remove FB.Facebook.apiClient.users_getInfo()
it works fine, but I need to get username somehow. Any tips?
Thanks.