我一直试图通过django-social-auth使用我的Django应用程序获得LinkedIn认证。我在/ complete / linkedin URL上收到了一个AuthTokenError。奇怪的是,我认为这与匿名用户的Django会话ID改变有关!
1)用户访问主页,session_key为X. 2)用户访问/登录/ linkedin,session_key仍为X. 3)用户在成功验证后从LinkedIn重定向,现在session_key为Y!
对于我的生活,我无法理解为什么会这样!
[127.0.0.1:2222] out: [14/Jun/2012 18:25:53] "GET /login/linkedin HTTP/1.0" 301 0
[127.0.0.1:2222] out: > /server/myapp.com/local/lib/python2.7/site-packages/social_auth/backends/__init__.py(574)auth_url()
[127.0.0.1:2222] out: 573 import ipdb; ipdb.set_trace()
[127.0.0.1:2222] out: --> 574 print self.request.session.session_key
[127.0.0.1:2222] out: 575 self.request.session[name] = token.to_string()
[127.0.0.1:2222] out:
[127.0.0.1:2222] out: ipdb> c
[127.0.0.1:2222] out: .eJxNy70KwjAQAGD0RdzcTvLXNB36GJ3L9XLB0DbBNF0EwcnnFqGD6wff-_x6nIbLEtPMPqY94V7vucQn-7HmmdOYcOXhk39-yMZUuPamCeRJSNAdCTAqIHQCNfiWrZgEGunw-vd6xla6Fi3oxhIY5xR00jKEyUqlhVAG3REIl2VCmkfKKcSysu9r2Xm7fQEeNDtE:1SfJOG:y2Mr30FBCGefUWjMAK0abGe1BbU
[127.0.0.1:2222] out: [14/Jun/2012 18:26:01] "GET /login/linkedin/ HTTP/1.0" 302 0
[127.0.0.1:2222] out: > /server/myapp.com/local/lib/python2.7/site-packages/social_auth/backends/__init__.py(583)auth_complete()
[127.0.0.1:2222] out: 582 import ipdb; ipdb.set_trace()
[127.0.0.1:2222] out: --> 583 print self.request.session.session_key
[127.0.0.1:2222] out: 584 if not unauthed_token:
[127.0.0.1:2222] out:
[127.0.0.1:2222] out: ipdb> c
[127.0.0.1:2222] out: gAJ9cQEu:1SfJ9u:KnhiuQen4cVGpahdN7a8p3OuxeU
[127.0.0.1:2222] out: [14/Jun/2012 18:26:03] ERROR [django.request] Internal Server Error: /complete/linkedin/
[127.0.0.1:2222] out: Traceback (most recent call last):
[127.0.0.1:2222] out: File "/server/myapp.com/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 111, in get_response
[127.0.0.1:2222] out: response = callback(request, *callback_args, **callback_kwargs)
[127.0.0.1:2222] out: File "/server/myapp.com/local/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 77, in wrapped_view
[127.0.0.1:2222] out: return view_func(*args, **kwargs)
[127.0.0.1:2222] out: File "/server/myapp.com/local/lib/python2.7/site-packages/social_auth/decorators.py", line 37, in wrapper
[127.0.0.1:2222] out: return func(request, backend, *args, **kwargs)
[127.0.0.1:2222] out: File "/server/myapp.com/local/lib/python2.7/site-packages/social_auth/views.py", line 38, in complete
[127.0.0.1:2222] out: return complete_process(request, backend, *args, **kwargs)
[127.0.0.1:2222] out: File "/server/myapp.com/local/lib/python2.7/site-packages/social_auth/views.py", line 96, in complete_process
[127.0.0.1:2222] out: user = auth_complete(request, backend, *args, **kwargs)
[127.0.0.1:2222] out: File "/server/myapp.com/local/lib/python2.7/site-packages/social_auth/views.py", line 164, in auth_complete
[127.0.0.1:2222] out: **kwargs)
[127.0.0.1:2222] out: File "/server/myapp.com/local/lib/python2.7/site-packages/social_auth/backends/contrib/linkedin.py", line 75, in auth_complete
[127.0.0.1:2222] out: return super(LinkedinAuth, self).auth_complete(*args, **kwargs)
[127.0.0.1:2222] out: File "/server/myapp.com/local/lib/python2.7/site-packages/social_auth/backends/__init__.py", line 583, in auth_complete
[127.0.0.1:2222] out: print self.request.session.session_key
[127.0.0.1:2222] out: AuthTokenError
[127.0.0.1:2222] out: [14/Jun/2012 18:26:04] "GET /complete/linkedin/?oauth_token=35cbc8ab-2cf2-4d5d-9d56-9fca71a31703&oauth_verifier=02980 HTTP/1.0" 500 420961
[127.0.0.1:2222] out: