python-social-auth如何使用Facebook获得UID fullname等



社交作物facebook身份验证。

我可以获取用户照片:

 <p>You are logged in as {{ user.username }} !</p>
<img src="http://graph.facebook.com/{{ user.username }}/picture?type=square" > <--working 

代码链接:https://github.com/omgbbqhaxx/python-social-auth/blob/master/master/master/examples/django_example/example/example/example/templates/done.htmll

我需要UserId,fullname,lastname如何获得?您可以向我发送拉请求。

定义此设置:

SOCIAL_AUTH_FACEBOOK_EXTRA_DATA = ['first_name', 'last_name']

然后您可以使用以下方式访问这些值

social = user.social_auth.get(provider='facebook')
userid = social.uid
first_name = social.extra_data['first_name']
last_name = social.extra_data['last_name']

最新更新