Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Email field return null (even if the “email” permission is set and accepted)

For some users in our application, the email field returns NULL even if the user has granted the email access to the app. When we check the scope parameter and the validity of the user Token thanks to the Debugger tool, everything is ok. The permission email has been accepted. But when we ask the Graph API for the email of the user with the valid user token, it does not appear at all.

Is there a way a user could prevent an app from getting his email even if he granted the email permission?

Thanks

like image 515
Benjamin Naïm Avatar asked Jul 08 '13 17:07

Benjamin Naïm


2 Answers

I had the same problem and I think I found out why: If the user has an unconfirmed email in Facebook (i.e. Facebook sent him a validation mail to the user's email address but he didn't respond) Facebook WILL NOT pass that email to your app even if he gave you the email permissions.

So what I did is use his or her Facebook email if the user has a user name (i.e. [email protected]).

like image 170
ozba Avatar answered Nov 06 '22 19:11

ozba


I have the same issue. It is working fine on my localhost, i am using php SDK for facebook login and when i submit my request it's return all the fields like email,name etc of the user but on server somehow it is not working.It will not returns user email. I have done lots of R&D on that and i have the solution for the issue. :)

$profile = $facebook->api('/me?fields=email,first_name,last_name');

if you are using php-sdk just passes fields like this it returns the email,first_name etc. Hopes it works for you all. thanks.

like image 11
user3020691 Avatar answered Nov 06 '22 20:11

user3020691