Search code examples
facebookfacebook-graph-api

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


Solution

  • 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. userName@facebook.com).