Facebook Api does not receive Email permission

Asked

Viewed 329 times

-1

Hello, I have a serious problem with the Facebook API, I have been trying to get the email to my Oauth system, but the api returned null, making the debug process discovered that in fact the APP is not asking for Email permission. Someone knows what I can do?

Here are the API permissions: Permissão no API - Developers.facebook.com

Here are the permissions requested during access: Request by Login

1 answer

0


HTML:

Basically, once the login is done, you will call in the callLoginMethod() method that will display the information.

<div class="fb-login-button" data-scope="email,user_birthday,user_hometown,user_location,user_location" data-max-rows="1" data-size="medium" data-show-faces="false" data-auto-logout-link="false" onlogin="callLoginMethod();" login_text="Entrar com o Facebook"> </div>

Javascript:

window.fbAsyncInit = function() {
    FB.init({
      appId      : SEU_APP_ID,
      xfbml      : true,
      version    : 'v2.8'
    });
  };



 (function(d, s, id){
     var js, fjs = d.getElementsByTagName(s)[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement(s); js.id = id;
     js.src = "//connect.facebook.net/en_US/sdk.js";
     fjs.parentNode.insertBefore(js, fjs);
   }(document, 'script', 'facebook-jssdk'));

function basicAPIRequest() {
    FB.api('/me', 
        {fields: "id,picture,birthday,email,first_name,gender,name,location,hometown"}, 
        function(response) {
          console.log('Resposta:', response);

        }
    );
  }

  function callLoginMethod() {
    FB.getLoginStatus(function(response) {
        if (response.status === 'connected') {
            basicAPIRequest();
        } else {
            FB.login();
        }
    }); 
  }
  • Okay, Thiago, the problem is not in the code. I have already tested with the SDK and the API in PHP, the problem is that when you accept the use of the app it does not ask for such information, only the name, gender and age that are public profile data. What I can not understand is why it does not release the request for Email, and by Developers.facebook in my app shows how released.

  • Go to the user’s facebook page, delete the application and repeat the process. I just made a page, with a newly created application ( that in case I do not have permission for anything, only email, name and id.) and used the code above to receive the information. My application is not even public, it is in development mode and only works properly for now with the developer profile.

  • Did you put the email permissions in the function Scope? put the code on the page.

  • Really Thiago, it was my mistake in Scope... Thanks for the help!

Browser other questions tagged

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