Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facebook empty email #81

Closed
ldim87 opened this issue Oct 19, 2018 · 5 comments
Closed

Facebook empty email #81

ldim87 opened this issue Oct 19, 2018 · 5 comments

Comments

@ldim87
Copy link

ldim87 commented Oct 19, 2018

Hi, I don't know if it is a library issue, but facebook returns null email even if permissions are set.

@denkurbatov
Copy link

@ldim87 Are you sure that user has email? Facebook allows users to register by phone number.

@ldim87
Copy link
Author

ldim87 commented Jan 30, 2019

It is my user and I have email for sure (in fact I have two - one primary and one secondary)... maybe it is a facebook bug of some sort... In php script when I do:

$user = $provider->getIdentity($accessToken);
var_dump ($user);

output is:
object(SocialConnect\Common\Entity\User)#19 (10) { ["id"]=> string(17) "xxxxx" ["firstname"]=> NULL ["lastname"]=> NULL ["email"]=> NULL ["emailVerified"]=> bool(true) ["birthday"]=> NULL ["username"]=> NULL ["sex"]=> NULL ["fullname"]=> string(10) "xxxxx" ["pictureURL"]=> NULL }

in config I have these settings:
...
'facebook' => [
'applicationId' => 'xxxx',
'applicationSecret' => 'xxxx',
'scope' => ['email', 'public_profile'],
'fields' => ['email']
],
...

@ovr
Copy link
Member

ovr commented Jan 30, 2019

@ldim87 You should configure facebook provider with

            'options' => [
                'identity.fields' => [
                    'email',
                ],
            ]

instead of fields

Example https://github.com/SocialConnect/auth/blob/master/example/config.php.dist#L15

I think you migrated from 1.x to 2.x without changing configuration...

Thanks

@ldim87
Copy link
Author

ldim87 commented Jan 30, 2019

Yes, that's it... Thanks. I think you should update the README.md

@ovr
Copy link
Member

ovr commented Jan 30, 2019

Thanks. I think you should update the README.md

Nice Catch 👍

@ovr ovr closed this as completed in c5e5cc8 Jan 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants