开发者

How to get a Facebook user's email address as the developer of an application?

开发者 https://www.devze.com 2023-01-10 19:23 出处:网络
Cross-posted from http://forum开发者_如何学编程.developers.facebook.com/viewtopic.php?pid=254519.

Cross-posted from http://forum开发者_如何学编程.developers.facebook.com/viewtopic.php?pid=254519.

I have users of my application who have granted the application the email extended permission, but I neglected to query for their email address at the time that they granted the permission, and so don't have it. I do have their facebook ID.

My understanding is that I can wait until they log in, and then use their session to query for their email address, which I can then store indefinitely. Is there a way that I, as a developer, can get their email address without them having to log in? That is, can I make a query using my session and get another user's email, if my session is that of a developer of an application to which they have granted email permissions?

If so, some sample code would be lovely. Thanks!


No need to wait for their login, you can still get it like this assuming they have provided you with email permission:

$email_info = $facebook->api_client->users_getInfo($user_id, "email");
print_r($email_info);
0

精彩评论

暂无评论...
验证码 换一张
取 消