Skip to content

Commit

Permalink
Fix an issue where Facebook returns an empty email due to recent API …
Browse files Browse the repository at this point in the history
…changes
  • Loading branch information
miled committed Jul 16, 2015
1 parent 6c4f69a commit 720aaae
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion hybridauth/Hybrid/Providers/Facebook.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,12 @@ function getUserProfile()
try{
$this->setAccessToken();

$data = $this->api->api('/me');
$fields = array(
'id', 'name', 'first_name', 'last_name', 'link', 'website',
'gender', 'locale', 'about', 'email', 'hometown', 'location'
);

$data = $this->api->api('/me?fields=' . implode(',', $fields));
}
catch( FacebookApiException $e ){
throw new Exception( "User profile request failed! {$this->providerId} returned an error", 6 );
Expand Down

4 comments on commit 720aaae

@levantoan
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much. So, please update to Wordpress Social Login Plugin (https://wordpress.org/plugins/wordpress-social-login)

Thanks again ^^

@ftena
Copy link
Contributor

@ftena ftena commented on 720aaae Jul 23, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing. Thank you! :)

@praveen-tripathi
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please confirm if existing users are also able to login using facebook. I am getting this error:
email error

@kingafrojoe
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am also getting the same error as @pktri-git.
It happens if the user has an account already and you want to link them.
I'm having a look for where the problem is.

Please sign in to comment.