4
Greetings guys,
I spent hours and hours researching some solution to this problem, including here on the site, but I couldn’t find anything to help me.
I’m implementing a Facebook site registration using the facebook api directly. I can make the connection, request the user’s permission and have the user’s data in return. The problem is that only comes the name and the id of the user, even if I pass on Cope I want the email information and public profile. I’m running this programming locally on an apache server by Xampp, could that be the problem? I did this programming directly in php and also by javascript and in both the situation is the same.
Thanks for your cooperation.
Follow the code used (even available in the facebook examples):
Oops, the code I’m using to test is the same as available in the face examples:
window.fbAsyncInit = function() {
FB.init({
appId : 1644402569130903,
cookie : true, // enable cookies to allow the server to access
// the session
xfbml : true, // parse social plugins on this page
version : 'v2.4' // use version 2.2
});
FB.getLoginStatus(function(response) {
statusChangeCallback(response);
});
};
function statusChangeCallback(response) {
console.log('statusChangeCallback');
if (response.status === 'connected') {
// Logged into your app and Facebook.
testAPI();
} else if (response.status === 'not_authorized') {
// The person is logged into Facebook, but not your app.
// document.getElementById('status').innerHTML = 'Please log ' +
// 'into this app.';
FB.login(function(response) {
console.log(response);
});
} else {
// The person is not logged into Facebook, so we're not sure if
// they are logged into this app or not.
// document.getElementById('status').innerHTML = 'Please log ' +
// 'into Facebook.';
FB.login(function(response) {
console.log(response);
});
}
}
function testAPI() {
console.log('Welcome! Fetching your information.... ');
FB.api('/me', function(response) {
console.log('Successful login for: ' + response.name);
console.log(response);
// Aqui ele loga no console a resposta vinda do facebook, mas vem apenas o ID e Nome do usuário..
});
}
**I tested on a server in the cloud and with other users besides mine, and even then I get only the name and ID of the logged in user.
Can you post the code too? Sometimes it can be because you are localhost, try going up to the server and redo the test.
– Sr. André Baill
Oops, I changed the question and includes the code used
– Ulisses Gabriel