I am using django_allauth in my project.
(1) How is a django user account created when a user logs in through a third party such as facebook?
You should take a look at:
- admin panel and find out what happens when someone logs in.
- allauth.facebook.views.login and try to track the login process.
This is something like this (in a few words):
- When a user logs into your site through their Facebook credentials, they are given an access token
- This token is stored in the FACEBOOK_ACCESS_TOKENS table (you can see it in the admin panel)
- Using this access token and using Facebook GraphApi, we know its social_id
- When we know his social_id - we can have his Facebook account from our database
- If we have not saved it in db yet - we save the Facebook account in the FACEBOOK_ACCOUNTS table (Facebook accounts in the admin panel)
- Then we create a user in the USERS table with the data contained in the Facebook account. (you can see the new user in the "Users" section of the admin panel)
(2) What username is assigned to this user and what password is used?
As I mentioned earlier using Facebook GraphApi, we get the username of the Facebook user and assign it to the user profile User.username
(3) Some third-party providers, such as Facebook, provide great information about the user, such as name, email address, etc., and how can we get and save them in the userβs account / profile?
Again - Facebook GraphApi - it will bring you the necessary information.
I have built-in django_allauth on my site and it works correctly. I will be happy to answer (if I can) if you have additional questions.
EDIT - to support the avatar ...
I think you need to take a look at the django_allauth settings and especially in:
SOCIALACCOUNT_AVATAR_SUPPORT (= 'avatar' in settings.INSTALLED_APPS)
Enable support for django avatar. When enabled, the user profile image is copied locally to django-avatar upon registration.
source share