Django Allauth Login instead of Signup

2020-06-29 01:01发布

问题:

I am using Django allauth for providing social login using GitHub and google. I have users already registered. I have to log in the users based on their emails. Firstly I tried authenticating with google, and it redirected me to a link /accounts/social/signup/

It prompted me a form with username and email of the user (the email column is already filled). If I give some username and click submit it creates a new user of that form. Instead of logging the current user. I am not understanding where the flaw is

settings.py code --

SOCIALACCOUNT_QUERY_EMAIL = True
ACCOUNT_AUTHENTICATION_METHOD='email'
ACCOUNT_EMAIL_REQUIRED = True
SOCIALACCOUNT_PROVIDERS = \
{'github': {
    'SCOPE': [
        'email',
    ],
  'google':
     {'SCOPE': ['https://www.googleapis.com/auth/userinfo.profile',
                'email'],
      'AUTH_PARAMS': {'access_type': 'online'}
     },
}

I am trying to login users based on their emails. Am I wrong at any point ??

My Login template

<a href="{% provider_login_url 'google' process='login' %}" class="connect google">
<a href="{% provider_login_url 'github' process='login' %}" class="connect github">

It is actually performing the operation of signup every time instead of login. How actually to prevent it and login users based on email?

Thanks!!