Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get fb user email using new php sdk

Tags:

php

facebook

i have asked the extended permission for user's primary email address. but, i can't find user's email from decoded fb signed_request. how to get user's email from new php sdk after user grants the extended permission for email address?

like image 262
theHack Avatar asked Jan 20 '23 06:01

theHack


1 Answers

You should use something like:

$facebook->api('/me?fields=email');

And the result:

Array
(
    [email] => XXXXXXXXXXXXXXX
    [id] => 579187142
)

IMPORTANT NOTE: Facebook gives the user the choice NOT to give your application the real email! so you have to be careful about this!

like image 173
ifaour Avatar answered Jan 28 '23 04:01

ifaour