我正在尝试在我的 Django 网站上配置 Linkedin 身份验证。我使用django-social-auth我遵循Docs中提到的步骤。我已经坚持了很长一段时间。
My settings.py
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'social_auth',
'mytests'
)
AUTHENTICATION_BACKENDS = ( 'social_auth.backends.contrib.linkedin.LinkedinBackend',
'django.contrib.auth.backends.ModelBackend',)
TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.contrib.messages.context_processors.messages',
'social_auth.context_processors.social_auth_by_name_backends',
'social_auth.context_processors.social_auth_backends',
'social_auth.context_processors.social_auth_by_type_backends',
'social_auth.context_processors.social_auth_login_redirect',
)
SOCIAL_AUTH_ENABLED_BACKENDS = ('linkedin',)
LINKEDIN_CONSUMER_KEY = 'py5pspq52ypesv' #API Key
LINKEDIN_CONSUMER_SECRET = 'OyzsrC5GqIo85z9GsWc' #Secret Key
LOGIN_REDIRECT_URL = 'checkbox'
LOGIN_ERROR_URL = '/login-error/'
SOCIAL_AUTH_COMPLETE_URL_NAME = 'socialauth_complete'
SOCIAL_AUTH_ASSOCIATE_URL_NAME = 'socialauth_associate_complete'
网址.py
url(r'', include('social_auth.urls')),
在我的模板中
<a href="{% url socialauth_begin 'linkedin' %}">linkedin</a>
我得到错误
Error!
Sorry but some error made you impossible to login.
Please try again Home