[Fixed]-How to get user email with python social auth with facebook and save it

56👍

After some changes in Facebook Login API – Facebook’s Graph API v2.4
You will have to add these lines to fetch email

SOCIAL_AUTH_FACEBOOK_SCOPE = ['email']
SOCIAL_AUTH_FACEBOOK_PROFILE_EXTRA_PARAMS = {
    'fields': 'id,name,email', 
}

14👍

I think the problem is using FACEBOOK_EXTENDED_PERMISSIONS.

According to http://python-social-auth.readthedocs.org/en/latest/backends/facebook.html#oauth2 you should use:

SOCIAL_AUTH_FACEBOOK_SCOPE = ['email']

0👍

Add this to your settings.py file

SOCIAL_AUTH_FACEBOOK_SCOPE = ['email']
👤endur

0👍

Are you doing it on the test website?

Re-read the documentation please: [https://python-social-auth.readthedocs.io/en/latest/backends/facebook.html#oauth2][1]

It says:

If you define a redirect URL in Facebook setup page, be sure to not define http://127.0.0.1:8000 or http://localhost:8000 because it won’t work when testing

Leave a comment