Get Facebook user likes in Python Social Auth

旧城冷巷雨未停 提交于 2019-12-01 01:08:43

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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!