WrongBackend at / login / error /不正确的身份验证服务“错误”

时间:2013-03-25 11:29:46

标签: django mongoengine django-socialauth

我正在尝试通过BitBucket,Github,LinkedIn实现社交媒体身份验证,我收到了错误消息 WrongBackend at / login / error / 身份验证服务不正确“错误” 对于LinkedIn和Bitbucket以及 对于Github,QueryDict:{u'error':[u'redirect_uri_mismatch']}。

我正在使用MongoEngine作为数据库存储

这是Bitbucket的追溯(类似于LinkedIn)

Environment:


Request Method: GET
Request URL: http://localhost:8000/login/error/

Django Version: 1.4.4
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'blogapp',
 'social_auth')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.7/dist-packages/social_auth/decorators.py" in wrapper
  29.                 raise WrongBackend(backend)

Exception Type: WrongBackend at /login/error/
Exception Value: Incorrect authentication service "error"

我在exaception“/usr/local/lib/python2.7/dist-packages/social_auth/decorators.py”的位置添加了一条跟踪,并获得了以下trace。谁能告诉我哪里出错了?这非常令人沮丧。

我的应用程序具有以下settings

在所有服务中,我已将我的应用程序URL注册为localhost:8000,并将callback url注册为localhost:8000 / callback /

[编辑]

我在其中一个答案中创建了sqlite3表,并创建了几个表。但问题仍然存在。

2 个答案:

答案 0 :(得分:0)

编辑:我之前关于使用sqlite3 db的回应是基于错误的假设。在这里查看代码是什么发生

  1. 您正在评论LOGIN_ERROR_URL。在这种情况下,工作流将我带到Linked,它会引发您提到的错误。
  2. 当您取消注释此行并尝试时,您可以看到它将您重定向到登录错误回调。
  3. 所以我猜你需要取消注释这一行,在已经注册Linked In应用程序的域上部署此代码并在那里进行测试。 (我想部分问题是你在Localhost上测试它就像我一样)

答案 1 :(得分:0)

我认为你的问题是回调网址。你告诉那些服务它是localhost:8000 / callback,但是django-social-auth以下面的形式提供它的回调:/ complete /(例如/ complete / github)。这不是所有这些后端的URL。