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

I can't get the user's eMail from a succesfull facebook's login #153

Open
famigone opened this issue May 26, 2016 · 6 comments
Open

I can't get the user's eMail from a succesfull facebook's login #153

famigone opened this issue May 26, 2016 · 6 comments

Comments

@famigone
Copy link

famigone commented May 26, 2016

In the user table, email column is empty, the rest it's fine. This is my web.php configuration:

           'facebook' => [
                'class' => 'yii\authclient\clients\Facebook',
                'authUrl' => 'https://www.facebook.com/dialog/oauth?display=popup',     
                'clientId' => '15805XXXXXXXXXXXX',
                'clientSecret' => '8c76YYYYYYYYYYYYYYYYYYYYYY',
                'scope' => 'email',
            ],

I even can see the facebook's oAuth pop up, where i accept the email permission.

@amnah
Copy link
Owner

amnah commented May 26, 2016

that means the user doesn't have an email. they probably signed up with a
phone number
On May 26, 2016 10:23 AM, "cognitivaxx" [email protected] wrote:

In the user table, email column is empty, the rest it's fine. This is my
web.php configuration:

'facebook' => [
'class' => 'yii\authclient\clients\Facebook',
'authUrl' => 'https://www.facebook.com/dialog/oauth?display=popup',
'clientId' => '1580509622246199',
'clientSecret' => '8c7654172fea1bb66e81834a7042e647',
'scope' => 'email',
],

I even can see the facebook's oAuth pop up, where i accept the email
permission.


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#153

@famigone
Copy link
Author

famigone commented May 26, 2016

I've checked it, even email duplicated but don't. The FB user was created with email, and that email did not previously exist in the database.

In auth_ket table, provider_attributes column i have this:
{"name":"John Lee","id":"1XXXXXXXXXXXX"}

@amnah
Copy link
Owner

amnah commented May 26, 2016

Then I don't know. You'll have to dump the data you get from facebook and check if you're actually getting an email.

https://github.com/amnah/yii2-user/blob/master/controllers/AuthController.php#L239-L241

print_r($attributes);
exit;

@famigone
Copy link
Author

Yes, it seems like i am not reciving email from FB:

Array ( [name] => John Lee [id] => 11XXXXXXXXXXX )

That's weird...

@famigone
Copy link
Author

Well, it seems there may be many reasons, in accordance with Facebook's boys:

  • No Email address on account
  • No confirmed email address on account
  • No verified email address on account
  • User entered a security checkpoint which required them to reconfirm their email address and they have not yet done so
  • Users's email address is unreachable
  • acount created with phone number

@amnah
Copy link
Owner

amnah commented Jun 2, 2016

Hmmm ... is it possible that the first time you authenticated, it didn't ask for email permission? Then the next time you changed the scope to ask for email, but because you didn't allow it the first time it doesn't send it.

Or would it ask you to to re-authorize because of different permissions?

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

2 participants