Do not receive email from facebook API at login

I have a problem logging in, I can’t get email even when adding email to user and friend permissions (for some facebook accounts).

I use facebook-php-sdk, this is the code that im uses

$facebook_user_profile = $facebook->api('/me', array('fields' => 'id,email,first_name,last_name,picture'));

please can someone save my day?

+6
source share
2 answers

In addition to CBroe commenting on the request for permissions using the "scope" parameter during login to grab permissions , you should also consider the fact that not every registered user (or a user allowing your application to access their information) has The email address assigned to their account.

you can check your facebook accounts using their mobile numbers, and therefore the likelihood that the letter does not exist. Therefore, when developing the application, consider if the user does not have email, then you must request it manually through the form after entering the system (this means that users must use email).

hope this information helps!

+9
source

The problem occurs when you create a Facebook account with an email address and do not confirm the email that Facebook will use. Once you confirm your email address, your Facebook account will return the email address.

Hope this solves the problem.

0
source

Source: https://habr.com/ru/post/950071/


All Articles