我正在尝试使用Facebook凭据实现网站登录。当我按Facebook小部件上的取消或Okay时,我看到不同的响应。当我按下取消时,我看到以下
Environment: Request Method: GET Request URL: http://wakevent.com/complete/facebook/?redirect_state=cvZGNl42bKvgcDDDezBy14VJ1Eit5OmT&error=access_denied&error_code=200&error_description=Permissions+error&error_reason=user_denied&state=cvZGNl42bKvgcDDDezBy14VJ1Eit5OmT Django Version: 1.8.2 Python Version: 2.7.6 Installed Applications: ('django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'mainapp', 'social.apps.django_app.default') Installed Middleware: ('django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', 'social.apps.django_app.middleware.SocialAuthExceptionMiddleware') Traceback: File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response 132. response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/usr/local/lib/python2.7/dist-packages/django/views/decorators/cache.py" in _wrapped_view_func 57. response = view_func(request, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/django/views/decorators/csrf.py" in wrapped_view 58. return view_func(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/social/apps/django_app/utils.py" in wrapper 51. return func(request, backend, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/social/apps/django_app/views.py" in complete 28. redirect_name=REDIRECT_FIELD_NAME, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/social/actions.py" in do_complete 43. user = backend.complete(user=user, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/social/backends/base.py" in complete 41. return self.auth_complete(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/social/utils.py" in wrapper 229. return func(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/social/backends/facebook.py" in auth_complete 68. self.process_error(self.data) File "/usr/local/lib/python2.7/dist-packages/social/backends/facebook.py" in process_error 60. super(FacebookOAuth2, self).process_error(data) File "/usr/local/lib/python2.7/dist-packages/social/backends/oauth.py" in process_error 363. raise AuthCanceled(self, data.get('error_description', '')) Exception Type: AuthCanceled at /complete/facebook/ Exception Value: Authentication process canceled
哪个是可预测的。但是当我按下Okay时,我发现了另一个错误。
Environment: Request Method: GET Request URL: http://wakevent.com/complete/facebook/?redirect_state=cvZGNl42bKvgcDDDezBy14VJ1Eit5OmT&code=AQBe5WWQYk9BJE2fvNIt0RWVYxLaddhXT6t3UQwtF3aJcvbbLrVwsMlxsKEgwulVAtV4WHlYG5lG1HbEHk_cjFhMfWEHy9B8dedrOZagw0AWyGVyvaFtRqOn8_3G8nQb2nEe-DZMdG13V7Jgzrebtu6QXxGuyNzZPVXRnbPiKGUz8jW2p-r_wWB7QAuW-6rdZuII8_1ePBBoGgzmLlKLvMLfZoCqI62h0slF5t2IoAraHahRtnkWeIeH6AVf5u4vzZ8qXatz9fuun8ZK-8rqv5p5HDWZOdydNGm7ZtNh0g1OSpZU4TFAGxAqWbo0LpgiCRs&state=cvZGNl42bKvgcDDDezBy14VJ1Eit5OmT Django Version: 1.8.2 Python Version: 2.7.6 Installed Applications: ('django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'mainapp', 'social.apps.django_app.default') Installed Middleware: ('django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', 'social.apps.django_app.middleware.SocialAuthExceptionMiddleware') Traceback: File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response 132. response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/usr/local/lib/python2.7/dist-packages/django/views/decorators/cache.py" in _wrapped_view_func 57. response = view_func(request, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/django/views/decorators/csrf.py" in wrapped_view 58. return view_func(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/social/apps/django_app/utils.py" in wrapper 51. return func(request, backend, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/social/apps/django_app/views.py" in complete 28. redirect_name=REDIRECT_FIELD_NAME, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/social/actions.py" in do_complete 43. user = backend.complete(user=user, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/social/backends/base.py" in complete 41. return self.auth_complete(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/social/utils.py" in wrapper 232. raise AuthCanceled(args[0]) Exception Type: AuthCanceled at /complete/facebook/ Exception Value: Authentication process canceled
我在80端口的Ubuntu 14.04 apache web服务器上本地运行该网站。我怀疑Facebook应用程序设置错误,但不知道要调试什么。
此外,我可以提到Twitter登录正在进行相同的设置。
请指教!
答案 0 :(得分:2)
我做错Facebook应用程序设置。在安全/服务器IP白名单中,我输入了127.0.0.1地址。删除此地址后问题就消失了(空格是okey)。
答案 1 :(得分:0)
检查重定向网址。在发布帖子请求时,我错误地指定了重定向URL和客户端ID。对于Facebook重定向URI是可选的。尝试删除它,它会正常工作。