Api facebook does not return date of birth

Asked

Viewed 705 times

2

I’m using the facebook api to log in and get some user data like name, surname etc.

 function apilogin() {
console.log('Welcome!  Fetching your information.... ');
FB.api('me/','GET',{fields:'first_name,last_name,email,birthday'}, function(response) {
  console.log('Successful login for: ' + response.first_name);
  document.getElementById('status').innerHTML =
    '<br>Nome: ' + response.first_name + '<br>Sobrenome: '+response.last_name + '<br>email: '+response.email+'<br>Data nascimento: '+response.birthday;
});


<div class="fb-login-button" data-max-rows="2" data-size="large" data-show-faces="false" data-auto-logout-link="false" scope="email,public_profile,user_birthday" onlogin='checkLoginState();' auth-type="rerequest">login com o facebook</div>

I set all permissions and parameters necessary, but it only returns the date when I just facebook where I created the application, I wonder if it is necessary some configuration in the application, or if it is lack of a specific syntax at least.

1 answer

2


The only information the Graph API provides without analysis is the public profile, the others need to undergo a review by Facebook, and, if approved, the application will be allowed to obtain the other requested information - probably for this reason you are not able to obtain the date of birth.

If your application requests this permission, Facebook will have to analyze how your application uses it.

When sending for analysis, be clear about the reason for age_range not be sufficient for your use case.

In test scenario it is possible for the app administrator to insert facebook accounts (users), as user test.

Reference Birthday. Interestingly, most integrations will only need the age_range accompanying permission public_profile.

  • 1

    Thanks man, I will send this request. I really entered a user as a test user and managed to recover the date of birth

Browser other questions tagged

You are not signed in. Login or sign up in order to post.