2

I'm using social_auth in my django project in order to provide facebook login. I'm trying to get the user email. Note that i'm testing it locally. I can see the email being supplied from facebook in the popup but it appears to be empty in my custom pipeline.

in kwargs: { [some stuff], 'username': 'xxx','email': '', 'last_name': 'xxx'})

Here is my configuration in settings.py (I tried everything) :

SOCIAL_AUTH_FACEBOOK_SCOPE = ['email', ]

SOCIAL_AUTH_PROTECTED_USER_FIELDS = ['email',]

SOCIAL_AUTH_FACEBOOK_PROFILE_EXTRA_PARAMS = {'fields': 'id,name,email,first_name,last_name'}
Artory
  • 845
  • 7
  • 13
  • Take the access token, and use it to try the same request in Graph API Explorer (that’ll help to first of all determine whether it’s an issue with your coding, or something else.) – CBroe Dec 07 '17 at 12:19
  • Okay thanks, do you have an example or a source on how to do that kind of request ? – Artory Dec 07 '17 at 12:35
  • https://developers.facebook.com/tools/explorer?method=GET&path=me%3Ffields%3Did%2Cname%2Cemail%2Cfirst_name%2Clast_name&version=v2.11 ... just supply your own access token (make a debug output somewhere in your app), or choose your own app id from the dropdown (then it should automatically populate the token field with one that includes all the permissions you granted to your app.) – CBroe Dec 07 '17 at 12:53
  • I spent 2 days to understand this error and finally I found it ... The problem was my email was not validated by facebook so the api didn't return me the email. Thank you very much you helped me a lot – Artory Dec 07 '17 at 13:23

0 Answers0