我使用django-social-auth在我的项目上创建了社交登录。在使用文档(http://psa.matiasaguirre.net/docs/configuration/porting_from_dsa.html)上的说明移植到python-social-auth时,我在登录Facebook时遇到了问题:
AuthCanceled at /en/complete/facebook/
Authentication process canceled
回溯:
File "/home/marcos/django/project/env/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
111. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/marcos/django/project/env/local/lib/python2.7/site-packages/django/db/transaction.py" in inner
394. return func(*args, **kwargs)
File "/home/marcos/django/project/env/local/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
52. response = view_func(request, *args, **kwargs)
File "/home/marcos/django/project/env/local/lib/python2.7/site-packages/django/views/decorators/csrf.py" in wrapped_view
57. return view_func(*args, **kwargs)
File "/home/marcos/django/project/env/local/lib/python2.7/site-packages/social/apps/django_app/utils.py" in wrapper
51. return func(request, backend, *args, **kwargs)
File "/home/marcos/django/project/env/local/lib/python2.7/site-packages/social/apps/django_app/views.py" in complete
28. redirect_name=REDIRECT_FIELD_NAME, *args, **kwargs)
File "/home/marcos/django/project/env/local/lib/python2.7/site-packages/social/actions.py" in do_complete
43. user = backend.complete(user=user, *args, **kwargs)
File "/home/marcos/django/project/env/local/lib/python2.7/site-packages/social/backends/base.py" in complete
41. return self.auth_complete(*args, **kwargs)
File "/home/marcos/django/project/env/local/lib/python2.7/site-packages/social/utils.py" in wrapper
232. raise AuthCanceled(args[0])
我也正确地更改了我的移植设置,但在这里他们仍然是。
SOCIAL_AUTH_FACEBOOK_KEY = 'app_id'
SOCIAL_AUTH_FACEBOOK_API_SECRET = 'secret'
AUTHENTICATION_BACKENDS = [
'social.backends.facebook.FacebookOAuth2',
'django.contrib.auth.backends.ModelBackend',
]
SOCIAL_AUTH_FACEBOOK_SCOPE = ['email', 'publish_actions']
SOCIAL_AUTH_FACEBOOK_UID_LENGTH = 223
SOCIAL_AUTH_FACEBOOK_NONCE_SERVER_URL_LENGTH = 200
SOCIAL_AUTH_FACEBOOK_ASSOCIATION_SERVER_URL_LENGTH = 200
SOCIAL_AUTH_FACEBOOK_ASSOCIATION_HANDLE_LENGTH = 200
SOCIAL_AUTH_USERNAME_IS_FULL_EMAIL = True
SOCIAL_AUTH_DISCONNECT_PIPELINE = (
'social.pipeline.disconnect.get_entries',
'social.pipeline.disconnect.revoke_tokens',
'social.pipeline.disconnect.disconnect'
)
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
LOGIN_REDIRECT_URL = "/"
SOCIAL_AUTH_LOGIN_ERROR_URL = '/'
SOCIAL_AUTH_RAISE_EXCEPTIONS = False
我做错了什么?