Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook javascript API: get username and image by session?

If i manage to get a response.session object, can i use it to get the current logged in users username and profile image?

Thanks

like image 716
Johan Avatar asked Mar 22 '11 16:03

Johan


2 Answers

FB.api('/me', function(response) {
    alert("Name: "+ response.name + "\nFirst name: "+ response.first_name + "ID: "+response.id);
    var img_link = "http://graph.facebook.com/"+response.id+"/picture"
});

More info here:

http://developers.facebook.com/docs/reference/javascript/FB.api/

like image 185
Aleadam Avatar answered Oct 30 '22 12:10

Aleadam


Additionnaly, you can get more personnal informations about connected user :

FB.api('/me', function(response) {
                console.log(response);
                });

Hope that helps

like image 21
nka11 Avatar answered Oct 30 '22 10:10

nka11