Djangoアプリでdjango-social-authを介してLinkedIn認証を取得しようとしています。/ complete/linkedinのURLでAuthTokenErrorが発生します。奇妙なことに、これは匿名ユーザーのDjangoセッションIDの変更に関係していると思います。
1)ユーザーがホームページにアクセスします。session_keyはXです。2)ユーザーは/ login /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: