I'm using Django 1.10.1 and allauth 0.27.0. I have enabled social network logins for google but have NULL for link parameters.
Configuration:
Settings.py (shortened)
INSTALLED_APPS = [
... skipped ...
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.google',
]
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
'allauth.account.auth_backends.AuthenticationBackend',
)
SOCIALACCOUNT_PROVIDERS = {
'google': {
'SCOPE': [
'https://www.googleapis.com/auth/userinfo.profile',
'https://www.googleapis.com/auth/userinfo.email'
],
'AUTH_PARAMS': { 'access_type': 'online' }
}
}
LOGIN_REDIRECT_URL = '/members/'
LOGOUT_URL = '/'
ACCOUNT_AUTHENTICATION_METHOD = 'email'
ACCOUNT_USER_MODEL_USERNAME_FIELD = None
ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
ACCOUNT_SIGNUP_PASSWORD_VERIFICATION = True
ACCOUNT_UNIQUE_EMAIL = True
ACCOUNT_USERNAME_REQUIRED = False
SOCIALACCOUNT_QUERY_EMAIL = ACCOUNT_EMAIL_REQUIRED
ACCOUNT_LOGOUT_ON_GET = True
urls.py (shortened)
url(r'^accounts/', include('allauth.urls')),
client id and secret key are also configured on /admin/socialaccount/socialapp/
On login page I have: (shortened)
{% load i18n l10n widget_tweaks account socialaccount staticfiles %}
{% get_providers as socialaccount_providers %}
{% for provider in socialaccount_providers %}
<li>
<a title="{{ provider.name }}" class="socialaccount_provider {{ provider.id }}" href="{% provider_login_url provider.id process=process scope=scope auth_params=auth_params %}">{{ provider.name }}</a>
</li>
{% endfor %}
When I hit the login page I see provider's url like:
http://127.0.0.1:8000/accounts/google/login/?process=NULL&scope=NULL&auth_params=NULL
in {{ socialaccount_providers }}
I have [<allauth.socialaccount.providers.google.provider.GoogleProvider object at 0x051A6E30>]
What do I wrong?
PS it's from Google:
Error: invalid_scope
Some requested scopes were invalid. {valid=[https://www.googleapis.com/auth/userinfo.email, https://www.googleapis.com/auth/userinfo.profile], invalid=[NULL]}
I found a problem, its because I overrided base allauth template and inserted another one template inside main, in original template it was:
{% include "socialaccount/snippets/provider_list.html" with process="login" %}
Just replaced
<li>
<a title="{{ provider.name }}" class="socialaccount_provider {{ provider.id }}" href="{% provider_login_url provider.id process=process scope=scope auth_params=auth_params %}">{{ provider.name }}</a>
</li>
for
<li>
<a title="{{ provider.name }}" class="socialaccount_provider {{ provider.id }}" href="{% provider_login_url provider.id process="login" %}">{{ provider.name }}</a>
</li>
scope=NULL&auth_params=NULL
is doesn't matter here.