omab / django-social-auth

Django social authentication made simple
https://groups.google.com/group/django-social-auth
BSD 3-Clause "New" or "Revised" License
2.65k stars 757 forks source link

[Twitter] HTTP Error 401: Unauthorized #522

Closed some1thatNeedsHelp closed 11 years ago

some1thatNeedsHelp commented 12 years ago

Hello,

When using the example app & Django 1.4 - I'm unable to enable logging in via twitter. I've gotten 'Google OAuth2' & 'facebook' working, so something is happening correctly- I would just like to have the option of a few more providers...

Traceback

Environment:

Request Method: GET
Request URL: http://xxx.xxx.xxx.xxx/login/twitter/

Django Version: 1.4.2
Python Version: 2.6.6
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.staticfiles',
 'django.contrib.messages',
 'django.contrib.admin',
 'social_auth',
 'app')
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',
 'example.middleware.ExampleSocialAuthExceptionMiddleware')

Traceback:
File "/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "../social_auth/decorators.py" in wrapper
  39.                 return func(request, backend, *args, **kwargs)
File "../social_auth/views.py" in auth
  28.     return auth_process(request, backend)
File "../social_auth/views.py" in auth_process
  87.         return HttpResponseRedirect(backend.auth_url())
File "../social_auth/backends/__init__.py" in auth_url
  578.         token = self.unauthorized_token()
File "../social_auth/backends/__init__.py" in unauthorized_token
  617.         response = self.fetch_response(request)
File "../social_auth/backends/__init__.py" in fetch_response
  636.         response = dsa_urlopen(request.to_url())
File "../social_auth/utils.py" in dsa_urlopen
  263.     return urlopen(*args, **kwargs)
File "/usr/lib64/python2.6/urllib2.py" in urlopen
  126.     return _opener.open(url, data, timeout)
File "/usr/lib64/python2.6/urllib2.py" in open
  397.             response = meth(req, response)
File "/usr/lib64/python2.6/urllib2.py" in http_response
  510.                 'http', request, response, code, msg, hdrs)
File "/usr/lib64/python2.6/urllib2.py" in error
  435.             return self._call_chain(*args)
File "/usr/lib64/python2.6/urllib2.py" in _call_chain
  369.             result = func(*args)
File "/usr/lib64/python2.6/urllib2.py" in http_error_default
  518.         raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)

Exception Type: HTTPError at /login/twitter/
Exception Value: HTTP Error 401: Unauthorized

Removed my IP address

Application Settings (in each products web UI)

Anyone have any ideas what I'm doing wrong regarding twitter?

omab commented 12 years ago

Which version of django-social-auth are you using? Could you paste the URL that's trying to being opened (I'm interested in the path)

some1thatNeedsHelp commented 12 years ago

Latest version.

Server IP: 192.168.0.7 Client IP: 192.168.0.6

Server URL: http://192.168.0.7/ Requesting URL: http://192.168.0.7/login/twitter/

_Just did this now_ Commands

[root@localhost ~]# git clone git://github.com/omab/django-social-auth.git
Initialized empty Git repository in /root/django-social-auth/.git/
remote: Counting objects: 6226, done.
remote: Compressing objects: 100% (2193/2193), done.
Receiving objects: 100% (6226/6226), 876.72 KiB | 1.05 MiB/s, done.
remote: Total 6226 (delta 4692), reused 5498 (delta 4012)
Resolving deltas: 100% (4692/4692), done.
[root@localhost ~]# cd django-social-auth/
[root@localhost django-social-auth]# git log | head
commit 68cdc802cc55ee68a1f480512cae25915a4f4fcd
Merge: e064aee 02c6d49
Author: Matías Aguirre <matiasaguirre@gmail.com>
Date:   Sun Nov 11 06:14:37 2012 -0800

    Merge pull request #519 from dgouldin/master

    Adding TripIt backend

commit e064aee038f1a1a3b52ac4df6af4d3097866b534
[root@localhost django-social-auth]# cd example/
[root@localhost example]# cp local_settings.py.template local_settings.py
[root@localhost example]# vi local_settings.py
[root@localhost example]# python manage.py syncdb
/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/conf/__init__.py:75: DeprecationWarning: The ADMIN_MEDIA_PREFIX setting has been removed; use STATIC_URL instead.
  "use STATIC_URL instead.", DeprecationWarning)
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table django_admin_log
Creating table social_auth_usersocialauth
Creating table social_auth_nonce
Creating table social_auth_association
Creating table app_customuser

You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes
Username (leave blank to use 'root'):
E-mail address: root@locahost.net
Password:
Password (again):
Superuser created successfully.
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
[root@localhost example]# python manage.py runserver 0.0.0.0:80
/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/conf/__init__.py:75: DeprecationWarning: The ADMIN_MEDIA_PREFIX setting has been removed; use STATIC_URL instead.
  "use STATIC_URL instead.", DeprecationWarning)
/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/conf/__init__.py:75: DeprecationWarning: The ADMIN_MEDIA_PREFIX setting has been removed; use STATIC_URL instead.
  "use STATIC_URL instead.", DeprecationWarning)
Validating models...

0 errors found
Django version 1.4.2, using settings 'example.settings'
Development server is running at http://0.0.0.0:80/
Quit the server with CONTROL-C.
[10/Nov/2012 06:47:25] "GET / HTTP/1.1" 200 6451
[10/Nov/2012 06:47:32] "GET /login/twitter/ HTTP/1.1" 500 132634
^C[root@localhost example]#

_Traceback _

Environment:

Request Method: GET
Request URL: http://192.168.0.7/login/twitter/

Django Version: 1.4.2
Python Version: 2.6.6
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.staticfiles',
 'django.contrib.messages',
 'django.contrib.admin',
 'social_auth',
 'app')
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',
 'example.middleware.ExampleSocialAuthExceptionMiddleware')

Traceback:
File "/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python2.6/site-packages/django_social_auth-0.7.9-py2.6.egg/social_auth/decorators.py" in wrapper
  39.                 return func(request, backend, *args, **kwargs)
File "/usr/lib/python2.6/site-packages/django_social_auth-0.7.9-py2.6.egg/social_auth/views.py" in auth
  28.     return auth_process(request, backend)
File "/usr/lib/python2.6/site-packages/django_social_auth-0.7.9-py2.6.egg/social_auth/views.py" in auth_process
  87.         return HttpResponseRedirect(backend.auth_url())
File "/usr/lib/python2.6/site-packages/django_social_auth-0.7.9-py2.6.egg/social_auth/backends/__init__.py" in auth_url
  620.         token = self.unauthorized_token()
File "/usr/lib/python2.6/site-packages/django_social_auth-0.7.9-py2.6.egg/social_auth/backends/__init__.py" in unauthorized_token
  662.         response = self.fetch_response(request)
File "/usr/lib/python2.6/site-packages/django_social_auth-0.7.9-py2.6.egg/social_auth/backends/__init__.py" in fetch_response
  685.         response = dsa_urlopen(request.to_url())
File "/usr/lib/python2.6/site-packages/django_social_auth-0.7.9-py2.6.egg/social_auth/utils.py" in dsa_urlopen
  264.     return urlopen(*args, **kwargs)
File "/usr/lib64/python2.6/urllib2.py" in urlopen
  126.     return _opener.open(url, data, timeout)
File "/usr/lib64/python2.6/urllib2.py" in open
  397.             response = meth(req, response)
File "/usr/lib64/python2.6/urllib2.py" in http_response
  510.                 'http', request, response, code, msg, hdrs)
File "/usr/lib64/python2.6/urllib2.py" in error
  435.             return self._call_chain(*args)
File "/usr/lib64/python2.6/urllib2.py" in _call_chain
  369.             result = func(*args)
File "/usr/lib64/python2.6/urllib2.py" in http_error_default
  518.         raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)

Exception Type: HTTPError at /login/twitter/
Exception Value: HTTP Error 401: Unauthorized

Request information

GET
No GET data
POST
No POST data
FILES
No FILES data
COOKIES
Variable    Value
csrftoken   
'plBj6RMn9aclWNQ8G73J9thOTSW5YO9o'
sessionid   
'67a1d9228171d3ea90526e13622ea9a8'
META
Variable    Value
SSH_ASKPASS 
'/usr/libexec/openssh/gnome-ssh-askpass'
wsgi.multiprocess   
False
KDE_IS_PRELINKED    
'1'
RUN_MAIN    
'true'
HTTP_COOKIE 
'csrftoken=plBj6RMn9aclWNQ8G73J9thOTSW5YO9o; sessionid=67a1d9228171d3ea90526e13622ea9a8'
SERVER_PROTOCOL 
'HTTP/1.1'
SERVER_SOFTWARE 
'WSGIServer/0.1 Python/2.6.6'
SCRIPT_NAME 
u''
LESSOPEN    
'|/usr/bin/lesspipe.sh %s'
SSH_CLIENT  
'192.168.0.6 50456 22'
SELINUX_USE_CURRENT_RANGE   
''
LOGNAME 
'root'
USER    
'root'
PATH    
'/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin'
QUERY_STRING    
''
QTDIR   
'/usr/lib64/qt-3.3'
PS1 
'[\\u@\\h \\W]\\$ '
wsgi.errors 
<open file '<stderr>', mode 'w' at 0x7f14abaa21e0>
LANG    
'en_US.UTF-8'
QTLIB   
'/usr/lib64/qt-3.3/lib'
TERM    
'xterm'
SHELL   
'/bin/bash'
TZ  
'America/Chicago'
SERVER_NAME 
'localhost.localdomain'
REMOTE_ADDR 
'192.168.0.6'
QTINC   
'/usr/lib64/qt-3.3/include'
G_BROKEN_FILENAMES  
'1'
HISTSIZE    
'1000'
REQUEST_METHOD  
'GET'
SERVER_PORT 
'80'
HOME    
'/root'
CONTENT_LENGTH  
''
HTTP_DNT    
'1'
HTTP_ACCEPT_CHARSET 
'ISO-8859-1,utf-8;q=0.7,*;q=0.3'
CSRF_COOKIE 
'plBj6RMn9aclWNQ8G73J9thOTSW5YO9o'
SELINUX_ROLE_REQUESTED  
''
HTTP_USER_AGENT 
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1'
HTTP_HOST   
'192.168.0.7'
wsgi.multithread    
True
HTTP_CONNECTION 
'keep-alive'
HTTP_CACHE_CONTROL  
'max-age=0'
_   
'/usr/bin/python'
HTTP_ACCEPT 
'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
KDEDIRS 
'/usr'
wsgi.file_wrapper   
''
SSH_CONNECTION  
'192.168.0.6 50456 192.168.0.7 22'
wsgi.version    
(1, 0)
GATEWAY_INTERFACE   
'CGI/1.1'
wsgi.run_once   
False
SSH_TTY 
'/dev/pts/0'
OLDPWD  
'/root/django-social-auth'
HOSTNAME    
'localhost.localdomain'
HTTP_ACCEPT_LANGUAGE    
'en-GB,en-US;q=0.8,en;q=0.6'
wsgi.input  
<socket._fileobject object at 0x26a80d0>
SELINUX_LEVEL_REQUESTED 
''
HISTCONTROL 
'ignoredups'
SHLVL   
'1'
PWD 
'/root/django-social-auth/example'
CVS_RSH 
'ssh'
DJANGO_SETTINGS_MODULE  
'example.settings'
CONTENT_TYPE    
'text/plain'
MAIL    
'/var/spool/mail/root'
LS_COLORS   
'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.tbz=01;31:*.tbz2=01;31:*.bz=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36:'
REMOTE_HOST 
''
HTTP_ACCEPT_ENCODING    
'gzip,deflate,sdch'
wsgi.url_scheme 
'http'
PATH_INFO   
u'/login/twitter/'

Settings

Settings
Using settings module example.settings
Setting Value
MONTH_DAY_FORMAT    
'F j'
VKONTAKTE_APP_ID    
''
USE_L10N    
True
USE_THOUSAND_SEPARATOR  
False
CSRF_COOKIE_SECURE  
False
LANGUAGE_CODE   
'en-us'
ROOT_URLCONF    
'example.urls'
MANAGERS    
()
TEMPLATE_LOADERS    
('django.template.loaders.filesystem.Loader',
 'django.template.loaders.app_directories.Loader')
SKYROCK_CONSUMER_SECRET 
u'********************'
DEFAULT_CHARSET 
'utf-8'
YANDEX_OAUTH2_CLIENT_KEY    
u'********************'
STATIC_ROOT 
''
DOUBAN_CONSUMER_SECRET  
u'********************'
ORKUT_CONSUMER_SECRET   
u'********************'
MESSAGE_STORAGE 
'django.contrib.messages.storage.fallback.FallbackStorage'
EMAIL_SUBJECT_PREFIX    
'[Django] '
SEND_BROKEN_LINK_EMAILS 
False
URL_VALIDATOR_USER_AGENT    
'Django/1.4.2 (https://www.djangoproject.com)'
STATICFILES_FINDERS 
('django.contrib.staticfiles.finders.FileSystemFinder',
 'django.contrib.staticfiles.finders.AppDirectoriesFinder')
YANDEX_OAUTH2_API_URL   
u'********************'
GOOGLE_OAUTH2_CLIENT_ID 
''
ODNOKLASSNIKI_OAUTH2_APP_KEY    
u'********************'
SESSION_COOKIE_DOMAIN   
None
SESSION_COOKIE_NAME 
'sessionid'
ADMIN_FOR   
()
TIME_INPUT_FORMATS  
('%H:%M:%S', '%H:%M')
DATABASES   
{'default': {'ENGINE': 'django.db.backends.sqlite3',
             'HOST': '',
             'NAME': 'test.db',
             'OPTIONS': {},
             'PASSWORD': u'********************',
             'PORT': '',
             'TEST_CHARSET': None,
             'TEST_COLLATION': None,
             'TEST_MIRROR': None,
             'TEST_NAME': None,
             'TIME_ZONE': 'America/Chicago',
             'USER': ''}}
FILE_UPLOAD_PERMISSIONS 
None
TIME_FORMAT 
'P'
FILE_UPLOAD_HANDLERS    
('django.core.files.uploadhandler.MemoryFileUploadHandler',
 'django.core.files.uploadhandler.TemporaryFileUploadHandler')
DEFAULT_CONTENT_TYPE    
'text/html'
SHOPIFY_SHARED_SECRET   
u'********************'
APPEND_SLASH    
True
FIRST_DAY_OF_WEEK   
0
DATABASE_ROUTERS    
[]
VKONTAKTE_APP_AUTH  
None
YEAR_MONTH_FORMAT   
'F Y'
STATICFILES_STORAGE 
'django.contrib.staticfiles.storage.StaticFilesStorage'
CACHES  
{'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
             'LOCATION': 'unique-snowflake'}}
YANDEX_APP_ID   
''
DAILYMOTION_OAUTH2_SECRET   
u'********************'
YANDEX_API_SECRET   
u'********************'
SERVER_EMAIL    
'root@localhost'
SESSION_COOKIE_PATH 
'/'
SHOPIFY_APP_API_KEY 
u'********************'
STOCKTWITS_CONSUMER_SECRET  
u'********************'
MIDDLEWARE_CLASSES  
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'example.middleware.ExampleSocialAuthExceptionMiddleware')
USE_I18N    
True
THOUSAND_SEPARATOR  
','
SECRET_KEY  
u'********************'
LANGUAGE_COOKIE_NAME    
'django_language'
FILE_UPLOAD_TEMP_DIR    
None
YANDEX_OAUTH2_CLIENT_SECRET 
u'********************'
TRANSACTIONS_MANAGED    
False
LOGGING_CONFIG  
'django.utils.log.dictConfig'
MAILRU_OAUTH2_CLIENT_KEY    
u'********************'
GOOGLE_OAUTH2_CLIENT_SECRET 
u'********************'
SKYROCK_CONSUMER_KEY    
u'********************'
WSGI_APPLICATION    
None
ORKUT_CONSUMER_KEY  
u'********************'
TEMPLATE_DEBUG  
True
X_FRAME_OPTIONS 
'SAMEORIGIN'
FOURSQUARE_CONSUMER_KEY 
u'********************'
DOUBAN_CONSUMER_KEY 
u'********************'
FORCE_SCRIPT_NAME   
None
USE_X_FORWARDED_HOST    
False
SIGNING_BACKEND 
'django.core.signing.TimestampSigner'
SESSION_COOKIE_SECURE   
False
CSRF_COOKIE_DOMAIN  
None
FILE_CHARSET    
'utf-8'
DEBUG   
True
SESSION_FILE_PATH   
None
DEFAULT_FILE_STORAGE    
'django.core.files.storage.FileSystemStorage'
INSTALLED_APPS  
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.staticfiles',
 'django.contrib.messages',
 'django.contrib.admin',
 'social_auth',
 'app')
ODNOKLASSNIKI_OAUTH2_CLIENT_KEY 
u'********************'
LANGUAGES   
(('ar', 'Arabic'),
 ('az', 'Azerbaijani'),
 ('bg', 'Bulgarian'),
 ('bn', 'Bengali'),
 ('bs', 'Bosnian'),
 ('ca', 'Catalan'),
 ('cs', 'Czech'),
 ('cy', 'Welsh'),
 ('da', 'Danish'),
 ('de', 'German'),
 ('el', 'Greek'),
 ('en', 'English'),
 ('en-gb', 'British English'),
 ('eo', 'Esperanto'),
 ('es', 'Spanish'),
 ('es-ar', 'Argentinian Spanish'),
 ('es-mx', 'Mexican Spanish'),
 ('es-ni', 'Nicaraguan Spanish'),
 ('et', 'Estonian'),
 ('eu', 'Basque'),
 ('fa', 'Persian'),
 ('fi', 'Finnish'),
 ('fr', 'French'),
 ('fy-nl', 'Frisian'),
 ('ga', 'Irish'),
 ('gl', 'Galician'),
 ('he', 'Hebrew'),
 ('hi', 'Hindi'),
 ('hr', 'Croatian'),
 ('hu', 'Hungarian'),
 ('id', 'Indonesian'),
 ('is', 'Icelandic'),
 ('it', 'Italian'),
 ('ja', 'Japanese'),
 ('ka', 'Georgian'),
 ('kk', 'Kazakh'),
 ('km', 'Khmer'),
 ('kn', 'Kannada'),
 ('ko', 'Korean'),
 ('lt', 'Lithuanian'),
 ('lv', 'Latvian'),
 ('mk', 'Macedonian'),
 ('ml', 'Malayalam'),
 ('mn', 'Mongolian'),
 ('nb', 'Norwegian Bokmal'),
 ('ne', 'Nepali'),
 ('nl', 'Dutch'),
 ('nn', 'Norwegian Nynorsk'),
 ('pa', 'Punjabi'),
 ('pl', 'Polish'),
 ('pt', 'Portuguese'),
 ('pt-br', 'Brazilian Portuguese'),
 ('ro', 'Romanian'),
 ('ru', 'Russian'),
 ('sk', 'Slovak'),
 ('sl', 'Slovenian'),
 ('sq', 'Albanian'),
 ('sr', 'Serbian'),
 ('sr-latn', 'Serbian Latin'),
 ('sv', 'Swedish'),
 ('sw', 'Swahili'),
 ('ta', 'Tamil'),
 ('te', 'Telugu'),
 ('th', 'Thai'),
 ('tr', 'Turkish'),
 ('tt', 'Tatar'),
 ('uk', 'Ukrainian'),
 ('ur', 'Urdu'),
 ('vi', 'Vietnamese'),
 ('zh-cn', 'Simplified Chinese'),
 ('zh-tw', 'Traditional Chinese'))
COMMENTS_ALLOW_PROFANITIES  
False
SOCIAL_AUTH_DEFAULT_USERNAME    
'socialauth_user'
STATICFILES_DIRS    
()
PREPEND_WWW 
False
SECURE_PROXY_SSL_HEADER 
None
SESSION_COOKIE_HTTPONLY 
True
FACEBOOK_APP_ID 
''
DEBUG_PROPAGATE_EXCEPTIONS  
False
LINKEDIN_CONSUMER_KEY   
u'********************'
SOCIAL_AUTH_FORCE_RANDOM_USERNAME   
False
LOGIN_URL   
'/accounts/login/'
SESSION_EXPIRE_AT_BROWSER_CLOSE 
False
LINKEDIN_CONSUMER_SECRET    
u'********************'
AUTHENTICATION_BACKENDS 
('social_auth.backends.twitter.TwitterBackend',
 'social_auth.backends.facebook.FacebookBackend',
 'social_auth.backends.google.GoogleOAuthBackend',
 'social_auth.backends.google.GoogleOAuth2Backend',
 'social_auth.backends.google.GoogleBackend',
 'social_auth.backends.yahoo.YahooBackend',
 'social_auth.backends.stripe.StripeBackend',
 'social_auth.backends.contrib.linkedin.LinkedinBackend',
 'social_auth.backends.contrib.skyrock.SkyrockBackend',
 'social_auth.backends.contrib.flickr.FlickrBackend',
 'social_auth.backends.contrib.instagram.InstagramBackend',
 'social_auth.backends.contrib.github.GithubBackend',
 'social_auth.backends.contrib.yandex.YandexBackend',
 'social_auth.backends.contrib.yahoo.YahooOAuthBackend',
 'social_auth.backends.contrib.foursquare.FoursquareBackend',
 'social_auth.backends.OpenIDBackend',
 'social_auth.backends.contrib.live.LiveBackend',
 'social_auth.backends.contrib.livejournal.LiveJournalBackend',
 'social_auth.backends.contrib.douban.DoubanBackend',
 'social_auth.backends.browserid.BrowserIDBackend',
 'social_auth.backends.contrib.vkontakte.VKontakteBackend',
 'social_auth.backends.contrib.yandex.YandexOAuth2Backend',
 'social_auth.backends.contrib.yandex.YaruBackend',
 'social_auth.backends.contrib.odnoklassniki.OdnoklassnikiBackend',
 'social_auth.backends.contrib.odnoklassniki.OdnoklassnikiAppBackend',
 'social_auth.backends.contrib.vkontakte.VKontakteOAuth2Backend',
 'social_auth.backends.contrib.mailru.MailruBackend',
 'social_auth.backends.contrib.dailymotion.DailymotionBackend',
 'social_auth.backends.contrib.shopify.ShopifyBackend',
 'social_auth.backends.contrib.stocktwits.StocktwitsBackend',
 'django.contrib.auth.backends.ModelBackend')
MAILRU_OAUTH2_CLIENT_SECRET 
u'********************'
DATE_INPUT_FORMATS  
('%Y-%m-%d',
 '%m/%d/%Y',
 '%m/%d/%y',
 '%b %d %Y',
 '%b %d, %Y',
 '%d %b %Y',
 '%d %b, %Y',
 '%B %d %Y',
 '%B %d, %Y',
 '%d %B %Y',
 '%d %B, %Y')
LOGIN_ERROR_URL 
'/login/error/'
VKONTAKTE_APP_SECRET    
u'********************'
CSRF_COOKIE_NAME    
'csrftoken'
EMAIL_HOST_PASSWORD 
u'********************'
PASSWORD_RESET_TIMEOUT_DAYS 
u'********************'
FOURSQUARE_CONSUMER_SECRET  
u'********************'
CACHE_MIDDLEWARE_ALIAS  
'default'
ROOT_PATH   
'/root/django-social-auth/example'
SESSION_SAVE_EVERY_REQUEST  
False
ADMIN_MEDIA_PREFIX  
'/admin-media/'
NUMBER_GROUPING 
0
TWITTER_CONSUMER_SECRET 
u'********************'
SESSION_ENGINE  
'django.contrib.sessions.backends.db'
CSRF_FAILURE_VIEW   
'django.views.csrf.csrf_failure'
CSRF_COOKIE_PATH    
'/'
LOGIN_REDIRECT_URL  
'/'
SOCIAL_AUTH_PIPELINE    
('social_auth.backends.pipeline.social.social_auth_user',
 'social_auth.backends.pipeline.associate.associate_by_email',
 'social_auth.backends.pipeline.misc.save_status_to_session',
 'app.pipeline.redirect_to_form',
 'app.pipeline.username',
 'social_auth.backends.pipeline.user.create_user',
 'social_auth.backends.pipeline.social.associate_user',
 'social_auth.backends.pipeline.social.load_extra_data',
 'social_auth.backends.pipeline.user.update_user_details')
LOGGING 
{'disable_existing_loggers': False,
 'filters': {'require_debug_false': {'()': 'django.utils.log.RequireDebugFalse'}},
 'handlers': {'mail_admins': {'class': 'django.utils.log.AdminEmailHandler',
                              'filters': ['require_debug_false'],
                              'level': 'ERROR'}},
 'loggers': {'django.request': {'handlers': ['mail_admins'],
                                'level': 'ERROR',
                                'propagate': True}},
 'version': 1}
IGNORABLE_404_URLS  
()
LOCALE_PATHS    
()
TEMPLATE_STRING_IF_INVALID  
''
MAILRU_OAUTH2_APP_KEY   
u'********************'
LOGOUT_URL  
'/accounts/logout/'
EMAIL_USE_TLS   
False
ODNOKLASSNIKI_OAUTH2_CLIENT_SECRET  
u'********************'
VK_API_SECRET   
u'********************'
FIXTURE_DIRS    
()
EMAIL_HOST  
'localhost'
DATE_FORMAT 
'N j, Y'
FACEBOOK_API_SECRET 
u'********************'
MEDIA_ROOT  
''
DEFAULT_EXCEPTION_REPORTER_FILTER   
'django.views.debug.SafeExceptionReporterFilter'
ADMINS  
()
FORMAT_MODULE_PATH  
None
DEFAULT_FROM_EMAIL  
'webmaster@localhost'
STOCKTWITS_CONSUMER_KEY 
u'********************'
SOCIAL_AUTH_ERROR_KEY   
u'********************'
MEDIA_URL   
''
DATETIME_FORMAT 
'N j, Y, P'
TEMPLATE_DIRS   
('/root/django-social-auth/example/templates',)
TWITTER_CONSUMER_KEY    
u'********************'
SITE_ID 
1
DISALLOWED_USER_AGENTS  
()
ALLOWED_INCLUDE_ROOTS   
()
DECIMAL_SEPARATOR   
'.'
SHORT_DATE_FORMAT   
'm/d/Y'
GITHUB_API_SECRET   
u'********************'
PROJECT_NAME    
'example'
TEST_RUNNER 
'django.test.simple.DjangoTestSuiteRunner'
CACHE_MIDDLEWARE_KEY_PREFIX 
u'********************'
TIME_ZONE   
'America/Chicago'
FILE_UPLOAD_MAX_MEMORY_SIZE 
2621440
SOCIAL_AUTH_CREATE_USERS    
True
EMAIL_BACKEND   
'django.core.mail.backends.smtp.EmailBackend'
DEFAULT_TABLESPACE  
''
TEMPLATE_CONTEXT_PROCESSORS 
('django.contrib.auth.context_processors.auth',
 'django.core.context_processors.debug',
 'django.core.context_processors.i18n',
 'django.core.context_processors.media',
 'django.contrib.messages.context_processors.messages',
 'social_auth.context_processors.social_auth_by_type_backends')
SESSION_COOKIE_AGE  
1209600
SETTINGS_MODULE 
'example.settings'
USE_ETAGS   
False
LANGUAGES_BIDI  
('he', 'ar', 'fa')
SOCIAL_AUTH_COMPLETE_URL_NAME   
'socialauth_complete'
DEFAULT_INDEX_TABLESPACE    
''
INTERNAL_IPS    
()
STATIC_URL  
'/static/'
VK_APP_ID   
''
EMAIL_PORT  
25
USE_TZ  
False
SHORT_DATETIME_FORMAT   
'm/d/Y P'
PASSWORD_HASHERS    
u'********************'
ABSOLUTE_URL_OVERRIDES  
{}
DAILYMOTION_OAUTH2_KEY  
u'********************'
CACHE_MIDDLEWARE_SECONDS    
600
DATETIME_INPUT_FORMATS  
('%Y-%m-%d %H:%M:%S',
 '%Y-%m-%d %H:%M:%S.%f',
 '%Y-%m-%d %H:%M',
 '%Y-%m-%d',
 '%m/%d/%Y %H:%M:%S',
 '%m/%d/%Y %H:%M:%S.%f',
 '%m/%d/%Y %H:%M',
 '%m/%d/%Y',
 '%m/%d/%y %H:%M:%S',
 '%m/%d/%y %H:%M:%S.%f',
 '%m/%d/%y %H:%M',
 '%m/%d/%y')
GITHUB_APP_ID   
''
EMAIL_HOST_USER 
''
PROFANITIES_LIST    
u'********************'
omab commented 12 years ago

Did the same and it worked just fine. I'm interested in the URL that's trying to be opened on line 263 in social_auth/utils.py.

some1thatNeedsHelp commented 12 years ago

Hmmm.... Its now line 264.... Not sure what's different. Anyway. Line 264:

Screenshot http://i.imgur.com/kcneW.png

Text version

/usr/lib/python2.6/site-packages/django_social_auth-0.7.9-py2.6.egg/social_auth/utils.py in dsa_urlopen

257. def dsa_urlopen(*args, **kwargs):
258.     """Like urllib2.urlopen but sets a timeout defined by
259.     SOCIAL_AUTH_URLOPEN_TIMEOUT setting if defined (and not already in
260.     kwargs)."""
261.     timeout = setting('SOCIAL_AUTH_URLOPEN_TIMEOUT')
262.     if timeout and 'timeout' not in kwargs:
263.         kwargs['timeout'] = timeout
264.     return urlopen(*args, **kwargs) ...
265. 
266. 
267. if __name__ == '__main__':
268.     import doctest
269.     doctest.testmod()

Variable    Value
args    
(u'https://api.twitter.com/oauth/request_token?oauth_body_hash=2**********************K%2FYBwk%3D&oauth_nonce=9******3&oauth_timestamp=1352553989&oauth_consumer_key=c********************A&oauth_signature_method=HMAC-SHA1&oauth_version=1.0&oauth_signature=6*************************g%3D&oauth_callback=http%3A%2F%2F192.168.0.7%2Fcomplete%2Ftwitter%2F',)
timeout 
None
kwargs  
{}

...And the error message & method/commands Screenshot http://i.imgur.com/aJxtN.png

Commands

[root@localhost ~]# git clone git://github.com/omab/django-social-auth.git
Initialized empty Git repository in /root/django-social-auth/.git/
remote: Counting objects: 6226, done.
remote: Compressing objects: 100% (2193/2193), done.
remote: Total 6226 (delta 4692), reused 5498 (delta 4012)
Receiving objects: 100% (6226/6226), 876.72 KiB | 636 KiB/s, done.
Resolving deltas: 100% (4692/4692), done.
[root@localhost ~]# cd django-social-auth/example/
[root@localhost example]# mv ~/local_settings.py ./
[root@localhost example]# ls -l local_settings.py*
-rw-r--r--. 1 root root 3056 Nov 10 13:21 local_settings.py
-rw-r--r--. 1 root root 2928 Nov 10 13:23 local_settings.py.template
[root@localhost example]# git log | head
commit 68cdc802cc55ee68a1f480512cae25915a4f4fcd
Merge: e064aee 02c6d49
Author: Matías Aguirre <matiasaguirre@gmail.com>
Date:   Sun Nov 11 06:14:37 2012 -0800

    Merge pull request #519 from dgouldin/master

    Adding TripIt backend

commit e064aee038f1a1a3b52ac4df6af4d3097866b534
[root@localhost example]# python manage.py syncdb
/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/conf/__init__.py:75: DeprecationWarning: The ADMIN_MEDIA_PREFIX setting has been removed; use STATIC_URL instead.
  "use STATIC_URL instead.", DeprecationWarning)
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table django_admin_log
Creating table social_auth_usersocialauth
Creating table social_auth_nonce
Creating table social_auth_association
Creating table app_customuser

You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes
Username (leave blank to use 'root'): 
E-mail address: root@pleasework.com
Password:
Password (again):
Superuser created successfully.
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
[root@localhost example]# python manage.py runserver 0.0.0.0:80
/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/conf/__init__.py:75: DeprecationWarning: The ADMIN_MEDIA_PREFIX setting has been removed; use STATIC_URL instead.
  "use STATIC_URL instead.", DeprecationWarning)
/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/conf/__init__.py:75: DeprecationWarning: The ADMIN_MEDIA_PREFIX setting has been removed; use STATIC_URL instead.
  "use STATIC_URL instead.", DeprecationWarning)
Validating models...

0 errors found
Django version 1.4.2, using settings 'example.settings'
Development server is running at http://0.0.0.0:80/
Quit the server with CONTROL-C.
[10/Nov/2012 07:26:28] "GET / HTTP/1.1" 200 6532
[10/Nov/2012 07:26:30] "GET /login/twitter/ HTTP/1.1" 500 132583
^CUnhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x27a2b10>>
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/abrt_exception_handler.py", line 198, in <lambda>
    sys.excepthook = lambda etype, value, tb: handleMyException((etype, value, tb))
TypeError: 'NoneType' object is not callable

Original exception was:
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/core/management/commands/runserver.py", line 111, in inner_run
    ipv6=self.use_ipv6, threading=threading)
  File "/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/core/servers/basehttp.py", line 253, in run
    httpd.serve_forever()
  File "/usr/lib64/python2.6/SocketServer.py", line 224, in serve_forever
    r, w, e = select.select([self], [], [], poll_interval)
AttributeError: 'NoneType' object has no attribute 'select'
[root@localhost example]#

Traceback


Environment:

Request Method: GET
Request URL: http://192.168.0.7/login/twitter/

Django Version: 1.4.2
Python Version: 2.6.6
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.staticfiles',
 'django.contrib.messages',
 'django.contrib.admin',
 'social_auth',
 'app')
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',
 'example.middleware.ExampleSocialAuthExceptionMiddleware')

Traceback:
File "/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python2.6/site-packages/django_social_auth-0.7.9-py2.6.egg/social_auth/decorators.py" in wrapper
  39.                 return func(request, backend, *args, **kwargs)
File "/usr/lib/python2.6/site-packages/django_social_auth-0.7.9-py2.6.egg/social_auth/views.py" in auth
  28.     return auth_process(request, backend)
File "/usr/lib/python2.6/site-packages/django_social_auth-0.7.9-py2.6.egg/social_auth/views.py" in auth_process
  87.         return HttpResponseRedirect(backend.auth_url())
File "/usr/lib/python2.6/site-packages/django_social_auth-0.7.9-py2.6.egg/social_auth/backends/__init__.py" in auth_url
  620.         token = self.unauthorized_token()
File "/usr/lib/python2.6/site-packages/django_social_auth-0.7.9-py2.6.egg/social_auth/backends/__init__.py" in unauthorized_token
  662.         response = self.fetch_response(request)
File "/usr/lib/python2.6/site-packages/django_social_auth-0.7.9-py2.6.egg/social_auth/backends/__init__.py" in fetch_response
  685.         response = dsa_urlopen(request.to_url())
File "/usr/lib/python2.6/site-packages/django_social_auth-0.7.9-py2.6.egg/social_auth/utils.py" in dsa_urlopen
  264.     return urlopen(*args, **kwargs)
File "/usr/lib64/python2.6/urllib2.py" in urlopen
  126.     return _opener.open(url, data, timeout)
File "/usr/lib64/python2.6/urllib2.py" in open
  397.             response = meth(req, response)
File "/usr/lib64/python2.6/urllib2.py" in http_response
  510.                 'http', request, response, code, msg, hdrs)
File "/usr/lib64/python2.6/urllib2.py" in error
  435.             return self._call_chain(*args)
File "/usr/lib64/python2.6/urllib2.py" in _call_chain
  369.             result = func(*args)
File "/usr/lib64/python2.6/urllib2.py" in http_error_default
  518.         raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)

Exception Type: HTTPError at /login/twitter/
Exception Value: HTTP Error 401: Unauthorized
stevejalim commented 11 years ago

I've got the same issue (Djagno==1.3.4, django-social-auth==0.7.9). I only created the oauth key and secret for this project yesterday and didn't see an option to allow 'Log in with Twitter' on the app settings. That may be significant here.

stevejalim commented 11 years ago

D'oh - facepalm time (always happens 30 seconds after posting). Looking at the settings, I'd been given the access tokens rather than the consumer tokens. Changing to the latter got me past the 401.

omab commented 11 years ago

@stevejalim, cool. @some1thatNeedsHelp, any progress on your side?

some1thatNeedsHelp commented 11 years ago

_Traceback _

Environment:

Request Method: GET
Request URL: http://192.168.0.7/

Django Version: 1.4.2
Python Version: 2.6.6
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'social_auth',
 'app')
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')

Template error:
In template /root/django-social-auth/example/example/templates/home.html, error at line 15
   No module named stripe
   5 : <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>

   6 : <script src="https://browserid.org/include.js" type="text/javascript"></script>

   7 : {% endblock %}

   8 : 

   9 : {% block heading %}Login using any of the following methods{% endblock %}

   10 : 

   11 : {% block content %}

   12 : <div>

   13 :   <h3>Login using <a href="http://oauth.net/" title="OAuth">OAuth</a> from:</h3>

   14 :   <ul>

   15 :    {% for name in social_auth.backends.oauth %} 

   16 :     <li><a rel="nofollow" href="{% url "socialauth_begin" name %}">{{ name|title }}</a></li>

   17 :   {% endfor %}

   18 :   </ul>

   19 : </div>

   20 : 

   21 : <div>

   22 :   <h3>Login using <a href="http://tools.ietf.org/html/draft-ietf-oauth-v2-10" title="OAuth2">OAuth2</a> from:</h3>

   23 :   <ul>

   24 :   {% for name in social_auth.backends.oauth2 %}

   25 :     <li><a rel="nofollow" href="{% url "socialauth_begin" name %}">{{ name|title }}</a></li>

Traceback:
File "/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "/root/django-social-auth/example/app/views.py" in home
  18.                                   RequestContext(request))
File "/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/shortcuts/__init__.py" in render_to_response
  20.     return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
File "/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/template/loader.py" in render_to_string
  176.         return t.render(context_instance)
File "/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/template/base.py" in render
  140.             return self._render(context)
File "/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/template/base.py" in _render
  134.         return self.nodelist.render(context)
File "/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/template/base.py" in render
  823.                 bit = self.render_node(node, context)
File "/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/template/debug.py" in render_node
  74.             return node.render(context)
File "/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/template/loader_tags.py" in render
  123.         return compiled_parent._render(context)
File "/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/template/base.py" in _render
  134.         return self.nodelist.render(context)
File "/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/template/base.py" in render
  823.                 bit = self.render_node(node, context)
File "/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/template/debug.py" in render_node
  74.             return node.render(context)
File "/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/template/loader_tags.py" in render
  62.             result = block.nodelist.render(context)
File "/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/template/base.py" in render
  823.                 bit = self.render_node(node, context)
File "/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/template/debug.py" in render_node
  74.             return node.render(context)
File "/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/template/defaulttags.py" in render
  138.             values = self.sequence.resolve(context, True)
File "/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/template/base.py" in resolve
  571.                 obj = self.var.resolve(context)
File "/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/template/base.py" in resolve
  721.             value = self._resolve_lookup(context)
File "/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/template/base.py" in _resolve_lookup
  751.                     current = current[bit]
File "/usr/lib/python2.6/site-packages/django_social_auth-0.7.7-py2.6.egg/social_auth/utils.py" in __getitem__
  247.             self._setup()
File "/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/utils/functional.py" in _setup
  248.         self._wrapped = self._setupfunc()
File "/usr/lib/python2.6/site-packages/django_social_auth-0.7.7-py2.6.egg/social_auth/context_processors.py" in context_value
  26.         data = backends_data(request.user)
File "/usr/lib/python2.6/site-packages/django_social_auth-0.7.7-py2.6.egg/social_auth/context_processors.py" in backends_data
  68.     available = get_backends().keys()
File "/usr/lib/python2.6/site-packages/django_social_auth-0.7.7-py2.6.egg/social_auth/backends/__init__.py" in get_backends
  810.             module = import_module(mod)
File "/usr/lib/python2.6/site-packages/Django-1.4.2-py2.6.egg/django/utils/importlib.py" in import_module
  35.     __import__(name)

Exception Type: ImportError at /
Exception Value: No module named stripe

Commands

[root@localhost ~]# git clone git://github.com/omab/django-social-auth.git
Initialized empty Git repository in /root/django-social-auth/.git/
remote: Counting objects: 6361, done.
remote: Compressing objects: 100% (2148/2148), done.
Receiving objects: 100% (6361/6361), 895.51 KiB | 702 KiB/s, done.
remote: Total 6361 (delta 4791), reused 5712 (delta 4192)
Resolving deltas: 100% (4791/4791), done.
[root@localhost ~]# cd django-social-auth/
[root@localhost django-social-auth]# git log | head
commit e06f4822277538bfe73767613f2fe165a14d7814
Author: Matías Aguirre <matiasaguirre@gmail.com>
Date:   Wed Nov 14 23:03:58 2012 -0200

    Updated example app to django 1.4

commit 36eb1247332f663601d07ec7074526b6d59b518c
Author: Matías Aguirre <matiasaguirre@gmail.com>
Date:   Wed Nov 14 22:02:28 2012 -0200

[root@localhost django-social-auth]# cd example/example/
[root@localhost example]# cp local_settings.py.template local_settings.py
[root@localhost example]# vi local_settings.py
[root@localhost example]# python manage.py syncdb
python: can't open file 'manage.py': [Errno 2] No such file or directory
[root@localhost example]# cd ..
[root@localhost example]# python manage.py syncdb
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table django_admin_log
Creating table social_auth_usersocialauth
Creating table social_auth_nonce
Creating table social_auth_association
Creating table app_customuser

You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes
Username (leave blank to use 'root'):
E-mail address: root@test.org
Password:
Password (again):
Superuser created successfully.
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
[root@localhost example]# python manage.py runserver 0.0.0.0:80
Validating models...

0 errors found
Django version 1.4.2, using settings 'example.settings'
Development server is running at http://0.0.0.0:80/
Quit the server with CONTROL-C.
[12/Nov/2012 06:38:21] "GET / HTTP/1.1" 500 281412
^C[root@localhost example]#
some1thatNeedsHelp commented 11 years ago

Fixed this first issue like so: commands

[root@localhost example]# sed -i "s/'social_auth.backends.stripe.StripeBackend',/#'social_auth.backends.stripe.StripeBackend',/" example/settings.py
[root@localhost example]# python manage.py runserver 0.0.0.0:80
Validating models...

0 errors found
Django version 1.4.2, using settings 'example.settings'
Development server is running at http://0.0.0.0:80/
Quit the server with CONTROL-C.
[12/Nov/2012 06:43:32] "GET / HTTP/1.1" 200 6478
[12/Nov/2012 06:43:35] "GET /sa/login/twitter/ HTTP/1.1" 500 131461
^C[root@localhost example]#

Trackback


Environment:

Request Method: GET
Request URL: http://192.168.0.7/sa/login/twitter/

Django Version: 1.4.2
Python Version: 2.6.6
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'social_auth',
 'app')
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.6/site-packages/Django-1.4.2-py2.6.egg/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python2.6/site-packages/django_social_auth-0.7.7-py2.6.egg/social_auth/decorators.py" in wrapper
  39.                 return func(request, backend, *args, **kwargs)
File "/usr/lib/python2.6/site-packages/django_social_auth-0.7.7-py2.6.egg/social_auth/views.py" in auth
  28.     return auth_process(request, backend)
File "/usr/lib/python2.6/site-packages/django_social_auth-0.7.7-py2.6.egg/social_auth/views.py" in auth_process
  87.         return HttpResponseRedirect(backend.auth_url())
File "/usr/lib/python2.6/site-packages/django_social_auth-0.7.7-py2.6.egg/social_auth/backends/__init__.py" in auth_url
  578.         token = self.unauthorized_token()
File "/usr/lib/python2.6/site-packages/django_social_auth-0.7.7-py2.6.egg/social_auth/backends/__init__.py" in unauthorized_token
  617.         response = self.fetch_response(request)
File "/usr/lib/python2.6/site-packages/django_social_auth-0.7.7-py2.6.egg/social_auth/backends/__init__.py" in fetch_response
  636.         response = dsa_urlopen(request.to_url())
File "/usr/lib/python2.6/site-packages/django_social_auth-0.7.7-py2.6.egg/social_auth/utils.py" in dsa_urlopen
  263.     return urlopen(*args, **kwargs)
File "/usr/lib64/python2.6/urllib2.py" in urlopen
  126.     return _opener.open(url, data, timeout)
File "/usr/lib64/python2.6/urllib2.py" in open
  397.             response = meth(req, response)
File "/usr/lib64/python2.6/urllib2.py" in http_response
  510.                 'http', request, response, code, msg, hdrs)
File "/usr/lib64/python2.6/urllib2.py" in error
  435.             return self._call_chain(*args)
File "/usr/lib64/python2.6/urllib2.py" in _call_chain
  369.             result = func(*args)
File "/usr/lib64/python2.6/urllib2.py" in http_error_default
  518.         raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)

Exception Type: HTTPError at /sa/login/twitter/
Exception Value: HTTP Error 401: Unauthorized
omab commented 11 years ago

@some1thatNeedsHelp, stripe error is caused because you are using the development example with django-social-auth installed in your python lib (DSA version 0.7.7 according to your traceback). So disabling that backend in AUTHENTICATION_BACKENDS in the example settings.py does that trick.

Try updating django-social-auth global package with sudo pip install --upgrade django-social-auth. I'm confused with your issue, I've just cloned the repo, did a syncdb, created a new twitter app, added the keys to local_settings.py, ran the server and it worked as expected.

Main difference between your setup and mine, is that I use virtualenv instead of installing packages globally.

some1thatNeedsHelp commented 11 years ago

The stripe error has now gone (by itself) Now removed the django_social_auth-*.egg, so the only trace of it, is whats in git repo.

You can see all the commands which Im doing. I'm restoring from a fresh CentOS 6.2 VM every time.

Traceback

Environment:

Request Method: GET
Request URL: http://192.168.0.7/login/twitter/

Django Version: 1.4.2
Python Version: 2.6.6
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'social_auth',
 'app')
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.6/site-packages/Django-1.4.2-py2.6.egg/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "../social_auth/decorators.py" in wrapper
  26.             return func(request, request.social_auth_backend, *args, **kwargs)
File "../social_auth/views.py" in auth
  28.     return auth_process(request, backend)
File "../social_auth/views.py" in auth_process
  87.         return HttpResponseRedirect(backend.auth_url())
File "../social_auth/backends/__init__.py" in auth_url
  618.         token = self.unauthorized_token()
File "../social_auth/backends/__init__.py" in unauthorized_token
  674.         return Token.from_string(self.fetch_response(request))
File "../social_auth/backends/__init__.py" in fetch_response
  696.         response = dsa_urlopen(request.to_url())
File "../social_auth/utils.py" in dsa_urlopen
  254.     return urlopen(*args, **kwargs)
File "/usr/lib64/python2.6/urllib2.py" in urlopen
  126.     return _opener.open(url, data, timeout)
File "/usr/lib64/python2.6/urllib2.py" in open
  397.             response = meth(req, response)
File "/usr/lib64/python2.6/urllib2.py" in http_response
  510.                 'http', request, response, code, msg, hdrs)
File "/usr/lib64/python2.6/urllib2.py" in error
  435.             return self._call_chain(*args)
File "/usr/lib64/python2.6/urllib2.py" in _call_chain
  369.             result = func(*args)
File "/usr/lib64/python2.6/urllib2.py" in http_error_default
  518.         raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)

Exception Type: HTTPError at /login/twitter/
Exception Value: HTTP Error 401: Unauthorized

Commands

[root@localhost ~]# rm -rf /usr/lib/python2.6/site-packages/django_social_auth-*
[root@localhost ~]# rm -rf django-social-auth/
[root@localhost ~]# git clone git://github.com/omab/django-social-auth.git
Initialized empty Git repository in /root/django-social-auth/.git/
remote: Counting objects: 6372, done.
remote: Compressing objects: 100% (2157/2157), done.
Receiving objects: 100% (6372/6372), 896.33 KiB | 742 KiB/s, done.
remote: Total 6372 (delta 4798), reused 5718 (delta 4194)
Resolving deltas: 100% (4798/4798), done.
[root@localhost ~]# cd django-social-auth/
[root@localhost django-social-auth]# git log | head
commit 0fcbc02ea426f013922310c960ab10a1e601943a
Author: Matías Aguirre <matiasaguirre@gmail.com>
Date:   Thu Nov 15 13:13:58 2012 -0200

    Restore login url path

commit 0f69f99c029ecdbaead163cb6724677679497050
Author: Matías Aguirre <matiasaguirre@gmail.com>
Date:   Thu Nov 15 13:01:18 2012 -0200

[root@localhost django-social-auth]# cd example/example/
[root@localhost example]# mv local_settings.py.template local_settings.py
[root@localhost example]# vi local_settings.py
[root@localhost example]# vi local_settings.py
[root@localhost example]# cd ..
[root@localhost example]# python manage.py syncdb
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table django_admin_log
Creating table social_auth_usersocialauth
Creating table social_auth_nonce
Creating table social_auth_association
Creating table app_customuser

You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes
Username (leave blank to use 'root'): root
E-mail address: root@root.net
Password:
Password (again):
Superuser created successfully.
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
[root@localhost example]# python manage.py runserver 0.0.0.0:80
Validating models...

0 errors found
Django version 1.4.2, using settings 'example.settings'
Development server is running at http://0.0.0.0:80/
Quit the server with CONTROL-C.
[12/Nov/2012 07:14:08] "GET / HTTP/1.1" 200 5637
[12/Nov/2012 07:14:10] "GET /login/twitter/ HTTP/1.1" 500 130461
^C[root@localhost example]#
omab commented 11 years ago

@some1thatNeedsHelp, this doesn't make sense to me, could you ping me on GTalk? You can add me using matiasaguirre [at] gmail.com, or in IRC in Freenode server under cadillac_ nick.

some1thatNeedsHelp commented 11 years ago
<cadillac_> I've updated your server date, it was set in the future and that invalidates OAuth process
<cadillac_> still, seems that the root of the issue is related with that (another user had the same issue a couple weeks ago), installing ntp did the trick
<cadillac_> I've installed ntp on your server and now it works :D
<cadillac_> I've used these steps to install ntp on centos http://www.cyberciti.biz/faq/howto-install-ntp-to-synchronize-server-clock/

Thanks for sorting it out =) @omab Speedy fix once again! /me takes his hat off