I\'m starting a project with Django and I\'m trying to allow users log in with Facebook. For the site purposes, I want to store the user likes in my database.
I took
Rename the setting SOCIAL_AUTH_SCOPE
to SOCIAL_AUTH_FACEBOOK_SCOPE
. Likes aren't sent automatically in the auth process, you need to query them to Facebook API, for example:
def get_likes(strategy, details, response, *args, **kwargs):
if strategy.backend.name == 'facebook':
likes = strategy.backend.get_json(
'https://graph.facebook.com/%s/likes' % response['id'],
params={'access_token': response['access_token']}
)
for like in likes['data']:
pass # Process and save likes here