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

Email is empty in login with Facebook #889

Closed
mapeveri opened this issue Apr 7, 2016 · 5 comments
Closed

Email is empty in login with Facebook #889

mapeveri opened this issue Apr 7, 2016 · 5 comments

Comments

@mapeveri
Copy link

mapeveri commented Apr 7, 2016

When login with Facebook, the email is always empty:

This is my 'details' response:

{'fullname': 'name', 'first_name': 'first_name', 'username': 'username', 'email': '', 'last_name': 'last_name'}

The graph say 'granted':

image

My settings.py:

AUTHENTICATION_BACKENDS = (
'social.backends.facebook.FacebookAppOAuth2',
'social.backends.facebook.FacebookOAuth2',
'social.backends.google.GoogleOpenId',
'social.backends.google.GoogleOAuth2',
'social.backends.google.GoogleOAuth',
'django.contrib.auth.backends.ModelBackend',
)

SOCIAL_AUTH_URL_NAMESPACE = 'social'

SOCIAL_AUTH_LOGIN_REDIRECT_URL = "/"

SOCIAL_AUTH_LOGIN_URL = "/"

SOCIAL_AUTH_EMAIL_VALIDATION_FUNCTION = 'apps.main.mail.send_validation'
SOCIAL_AUTH_EMAIL_VALIDATION_URL = '/email_sent/'
SOCIAL_AUTH_FORCE_EMAIL_VALIDATION = True

SOCIAL_AUTH_PROTECTED_USER_FIELDS = ['email']

SOCIAL_AUTH_FACEBOOK_SCOPE = ['email']

SOCIAL_AUTH_PIPELINE = (
'social.pipeline.social_auth.social_details',
'social.pipeline.social_auth.social_uid',
'social.pipeline.social_auth.auth_allowed',
'social.pipeline.social_auth.social_user',
'social.pipeline.user.get_username',
'apps.main.pipelines.require_email',
'apps.main.pipelines.custom_mail_validation',
'social.pipeline.social_auth.associate_by_email',
'social.pipeline.user.create_user',
'social.pipeline.social_auth.associate_user',
'social.pipeline.social_auth.load_extra_data',
'social.pipeline.user.user_details',
'apps.main.pipelines.login'
)

Any idea?

Thanks!

@luis8
Copy link

luis8 commented Apr 26, 2016

@mapeveri I'm also facing this problem, did you find a solution?

@luis8
Copy link

luis8 commented Apr 26, 2016

okay, i just find the solution. You need to add this to your settings file

SOCIAL_AUTH_FACEBOOK_PROFILE_EXTRA_PARAMS = {
'fields': 'id,name,email',
}

I didn't see this in the docs, so i think they need an update on this matter

@mapeveri
Copy link
Author

@luis8 thanks, It works perfect.

One question:

This line:

SOCIAL_AUTH_FACEBOOK_SCOPE = ['email']

What is the difference with the other line?

Thanks!

@luis8
Copy link

luis8 commented May 1, 2016

@mapeveri the first one is for the email permissions in facebook, without it the facebook dialog wont ask for access to the email permission, but it seems like it is a little redundant IMO.

@mapeveri
Copy link
Author

mapeveri commented May 1, 2016

@luis8 perfect.

Thanks!

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