Check the facebook?

Guys, you need to do registration on the website through facebook. Do everything as in the documentation.
And I have a problem. If the user is logged in through the computer, it turns out all good. But if a mobile phone, not all fields facebook gives, that is, email is empty, and it is actually everything we have.
Here is my code. And I don't know what nm is not so, as they did in the documentation.
the <script>
handle_fb_data function(response){
 FB.api('/me?fields=id,email,link,last_name,first_name', function(response) {
 // console.log('Successful login for:' + response.name);
console.log(JSON.stringify(response));


$.ajax({
 type: 'post',
 url: '/ajax/reg_user_fb.php',
data:response,
 success: function(msg) {
console.log(msg);
 data = JSON.parse(msg);
 if (data.rez=='true'){
window.location.reload();
}
},
 error: function(){}
})

});
}

 function fb_login(){
 FB.getLoginStatus(function(response) {
 if (response.authResponse) {
 // console.log('Welcome! Fetching your information.... ');
handle_fb_data(response);
 } else {
FB.login(function(response){
 if (response.authResponse) {
 // console.log('Welcome! Fetching your information.... ');
handle_fb_data(response);
 } else {
}
});
}
 }, {
 scope: 'email,id,link,last_name,first_name'
});
}

 window.fbAsyncInit = function() {
FB.init({
 appId : 'idприложения',
 cookie : true, // enable cookies to allow the server to access
 // the session
 xfbml : true, // parse social plugins on this page
 version : 'v2.11' // use graph api version 2.8
});
};
 // Load the SDK asynchronously
 (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/ru_RU/sdk.js";
 fjs.parentNode.insertBefore(js, fjs);
 }(document, 'script', 'facebook-jssdk'))

</script>

//button
<a class="social-login-fb soc_facebook" onclick="fb_login();" href="javascript:void(0)"></a>
June 10th 19 at 15:14
1 answer
June 10th 19 at 15:16
1. Scope is incorrect. https://developers.facebook.com/docs/facebook-logi...

2. If the user is logged with phone, then email it probably is not.
Even despite the fact that the user has registered through the mail?
And how to be, how to get your mail, if the registration will be phone? - Kamron29 commented on June 10th 19 at 15:19
you need to register a user id with empty email or ask to enter the address on the website. - raou commented on June 10th 19 at 15:22
, clearly, thanks. I'll figure it out! - Kamron29 commented on June 10th 19 at 15:25

Find more questions by tags PHPFacebookJavaScript