In my django project I am using django social-auth-app-django for google login to website.Everything is fine,but When user wants to login with google,if user has registired website before,I want to return this user.So ı don't want to create new user.Hox can I do that.I guess ı have to use SOCIAL_AUTH_PIPELINE but I don't know exactly this is works.Can anyone help me for that??
Asked
Active
Viewed 121 times
1 Answers
0
Check if user already has a socialaccount from google, if so login, if not create new account.
from allauth.socialaccount.models import SocialAccount
social_account = SocialAccount.objects.get(provider="google", uid=uid) #uid is from user
registered_user = social_account.user

saro
- 705
- 3
- 13
-
Thanks,but I am not using django-allauth.I am using social_django.I guess it won't be work in my project – Muhammet Aydoğan Apr 21 '22 at 14:52