-
Notifications
You must be signed in to change notification settings - Fork 754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
URLError at /social-auth/complete/facebook/ #315
Comments
Seems that you are being disconnected when DSA exchanges the App domain and Site URL is enough. |
Just tested with |
mydomain.lol - is a subst for a real domain that works fine. App type is |
I spent a long time trying to figure this one out - the url that the facebook.py code is trying to fetch there on line 100 is Basically, it's the last step that the library tries to carry out in order to request a long term access token. When I printed that url out and went to it in my browser, it worked fine. The problem appears to be related to urllib2 and certain https websites. We found that the problem exists with python 2.7.3 but not with python 2.7.1, so our ultimate solution was to throw up our hands and revert to 2.7.1. Not a very good solution - we should probably submit a patch to set up urllib2 correctly in facebook.py |
Oh, I should also add - I see your python version is 2.7.2 above. Are you using the python from MacPorts? We found that python 2.7.2 revision 1 worked fine, but revision 4 did not, and I believe the version of openssl changed somewhere in between there, which was the ultimate cause of the problem. |
FYI, I found a workaround for this issue. It works using the latest python version on mac - 2.7.3. At the top of my login handler (NOT facebook.py), before I load my login page - I run the following code taken from Ian Weatherbee on http://bugs.python.org/issue11220. custom HTTPS opener, banner's oracle 10g server supports SSLv3 onlyimport httplib, ssl, urllib2, socket
class HTTPSHandlerV3(urllib2.HTTPSHandler): install openerurllib2.install_opener(urllib2.build_opener(HTTPSHandlerV3())) This ensures that the sslv3 handler is installed before any other urllib2 code runs, which for me, fixes the issue coming from facebook.py. |
@salomo851, i put that code into the top of my views, and it works fine! Thank you!
I use debian wheezy with python from repos, version is Thanks again! I'll check if any other auth-backends work fine with this workaround. |
vkontakte, twitter, mailru, google-oauth2, github, dropbox, linkedin, yandex, yahoo, instagram, flickr, foursquare works fine (i see, this check was not necessary, but %s). And also with fb-backend i got regirect back to |
I've added a comment about this issue in the docs http://django-social-auth.readthedocs.org/en/latest/miscellaneous.html#python-2-7-2rev4-2-7-3-and-facebook-backend. Thanks for the bug hunting and the detailed explanation. |
Hi. I have some trouble with facebook backend. Also i've tried @krvss fork and got the same error. I see, almost all backends work fine (google-oauth2, instagram, flickr, vkontakte, yandex, ...), so it seems the reason is on my side.
I guess the wrong settings may be the reason. I fill only "App Domain" and "Site URL" - is it enough?
So, i got the fb question after redirect, and then this:
Environment:
Request Method: GET
Request URL: http://mydomain.lol/social-auth/complete/facebook/?code=AQBOGXjtD2ruIyF3SHGKN_vpU9KszD1By52QjXHym7SU12_fMy1hfFJuRYDzqVfbVGIaYgSt9Lh5TfADqsBvqL5tzL3IJ6tT6i9b3G_V-vc0EJPzwDF9fEMG4LNTVEuDjq7Lp1Bo6wEFWxqy5vzMRuSr4mrlCoicS2xJtN27A1kpZSOR0FjBSTHnoLsBp28f6Hc
Django Version: 1.4
Python Version: 2.7.2
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'django.contrib.admindocs',
'social_auth',
'tel.po',
'tel.telehome')
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/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
Exception Type: URLError at /social-auth/complete/facebook/
Exception Value: <urlopen error [Errno 104] Connection reset by peer>
The text was updated successfully, but these errors were encountered: