I am trying to access the profile picture and posts of the user using Django-AllAuth
. Here is the template where I am trying to load the profile image:
<html>
<body>
Welcome back {{ user.first_name }} {{ user.age }}
<img src={{user.cover.source}} height="60" width="60">
<a href="/">Home</a>
</body>
</html>
Here is the view.py
def fb_personality_traits(request):
# logger.debug('FB Page Loaded')
return render(request, 'home/facebook_personality_traits.html')
Settings.py
SITE_ID = 1
LOGIN_REDIRECT_URL = '/facebook_personality_traits/'
SOCIALACCOUNT_QUERY_EMAIL = True
SOCIALACCOUNT_PROVIDERS = {
'facebook': {
'SCOPE': ['email', 'user_posts', 'public_profile', 'user_photos'],
# 'AUTH_PARAMS': {'auth_type': 'reauthenticate'},
'METHOD': 'js_sdk',
'FIELDS': [
'id',
'email',
'name',
'first_name',
'last_name',
'cover',
'posts',
'age',
],
'EXCHANGE_TOKEN': True,
'VERIFIED_EMAIL': True,
'VERSION': 'v2.10',
}
}
ACCOUNT_LOGOUT_ON_GET = True
Here I am not getting the image. See the below result:
What I want to achieve?
1) I want to display the profile image on the screen.
2) I want to get the posts of the user loggedin in the view.py
and send it on the screen to display on the template.