I'm already able to login with facebook but I do not get the person's photo, how do I do that?
I saw some things like '' link
But how can I use this?
I'm already able to login with facebook but I do not get the person's photo, how do I do that?
I saw some things like '' link
But how can I use this?
I did this:
FB.getLoginStatus(function(response){
if(response.status == 'connected') {
FB.ui(obj, callback);
}
else {
FB.login(function(response){
if(response.status == 'connected') {
//Depois do login chamo o callback
FB.ui(obj, callback);
}
});
}
});
//Função do callback
function callback(response) {
if(response.error_code == 4201)
{
}
else
{
//Como no post_id retornado vem a {id}_{post_id}, eu dou um split e pego a ID.
var ids = response['post_id'].split('_');
//Como eu usei o angular, fiz os comandos abaixo, mas se quiser apenas a id -> ids[0];
var appElement = document.querySelector('[ng-controller=FbController]');
var $scope = angular.element(appElement).scope();
$scope.$apply(function() {
$scope.addJson(ids[0]);
});
}
}
To get the photo I used the http://graph.facebook.com/v2.6/{{id}}/picture
API