php - Email scope problem / email address isn't sent in /me request

263

I'm using PHP SDK 3.1 and I have a problem with retrieving email from /me request. My scope looks like:

protected $scope = 'email,offline_access,publish_stream,user_birthday,user_location,user_work_history,user_about_me,user_hometown';

and I'm getting url by:

$this->fb->getLoginUrl(array('scope' => $this->scope));

where $this->fb is an Facebook instance.

Problem is when i call

$userProfile = $this->fb->api('/me');

Variable $userProfile contains a lot of data but there is no email. Few days ago it worked but somehow it stopped.

What should i do to get email?

Thanks in advice.

663

Answer

Solution:

I'm using same kit and the following, works just fine.user_about_me should not be necessary.

$loginUrl = $facebook->getLoginUrl( array('scope' => 'user_about_me,email' ) );

Nota : If you did not give the rights upfront, try re-authorizing the app for the user.

440

Answer

Solution:

$this->fb->getLoginUrl(array('req_perms' => 'email'))

should work but remember that you can only get the connected user email and not his friends emails

People are also looking for solutions to the problem: JQuery JSONP turn result into PHP array

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.