Facebook JS API: users_getInfo() inside ifUserConnected() deadlock.
Posted
by serg555
on Stack Overflow
See other posts from Stack Overflow
or by serg555
Published on 2010-02-10T19:23:43Z
Indexed on
2010/03/20
22:01 UTC
Read the original article
Hit count: 285
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.
© Stack Overflow or respective owner