From 314058ab5055d575794dca4a350e69a57bb57880 Mon Sep 17 00:00:00 2001 From: Lucho Yankov Date: Fri, 24 Dec 2010 21:46:05 +0200 Subject: [PATCH 1/2] Added `verifier=None` to `from_consumer_and_token`. twitter.py and linkedin.py were passing `verifier` parameter and this produced exceptions when login to Twitter and Linkedin. --- socialauth/lib/oauth2.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/socialauth/lib/oauth2.py b/socialauth/lib/oauth2.py index 5044fb4..9f3f9ef 100644 --- a/socialauth/lib/oauth2.py +++ b/socialauth/lib/oauth2.py @@ -258,7 +258,7 @@ def from_request(http_method, http_url, headers=None, parameters=None, from_request = staticmethod(from_request) def from_consumer_and_token(oauth_consumer, token=None, - http_method=HTTP_METHOD, http_url=None, parameters=None): + http_method=HTTP_METHOD, http_url=None, parameters=None, verifier=None): if not parameters: parameters = {} @@ -591,4 +591,4 @@ def build_signature_base_string(self, oauth_request, consumer, token): def build_signature(self, oauth_request, consumer, token): key, raw = self.build_signature_base_string(oauth_request, consumer, token) - return key \ No newline at end of file + return key From 8897e6f397654c5f4d107c81a149d674f6fd7311 Mon Sep 17 00:00:00 2001 From: Lucho Yankov Date: Sat, 25 Dec 2010 15:31:43 +0200 Subject: [PATCH 2/2] Changed the oauth lib with oauth2. --- example_project/localsettings.example.py | 95 ------------------------ socialauth/lib/oauthtwitter2.py | 2 +- 2 files changed, 1 insertion(+), 96 deletions(-) delete mode 100644 example_project/localsettings.example.py diff --git a/example_project/localsettings.example.py b/example_project/localsettings.example.py deleted file mode 100644 index 16a56bf..0000000 --- a/example_project/localsettings.example.py +++ /dev/null @@ -1,95 +0,0 @@ -OPENID_REDIRECT_NEXT = '/accounts/openid/done/' - -OPENID_SREG = {"requred": "nickname, email, fullname", - "optional":"postcode, country", - "policy_url": ""} - -#example should be something more like the real thing, i think -OPENID_AX = [{"type_uri": "http://axschema.org/contact/email", - "count": 1, - "required": True, - "alias": "email"}, - {"type_uri": "http://axschema.org/schema/fullname", - "count":1 , - "required": False, - "alias": "fname"}] - -OPENID_AX_PROVIDER_MAP = {'Google': {'email': 'http://axschema.org/contact/email', - 'firstname': 'http://axschema.org/namePerson/first', - 'lastname': 'http://axschema.org/namePerson/last'}, - 'Default': {'email': 'http://axschema.org/contact/email', - 'fullname': 'http://axschema.org/namePerson', - 'nickname': 'http://axschema.org/namePerson/friendly'} - } - -TWITTER_CONSUMER_KEY = '' -TWITTER_CONSUMER_SECRET = '' - -FACEBOOK_APP_ID = '' -FACEBOOK_API_KEY = '' -FACEBOOK_SECRET_KEY = '' - -LINKEDIN_CONSUMER_KEY = '' -LINKEDIN_CONSUMER_SECRET = '' - -## if any of this information is desired for your app -FACEBOOK_EXTENDED_PERMISSIONS = ( - #'publish_stream', - #'create_event', - #'rsvp_event', - #'sms', - #'offline_access', - #'email', - #'read_stream', - #'user_about_me', - #'user_activites', - #'user_birthday', - #'user_education_history', - #'user_events', - #'user_groups', - #'user_hometown', - #'user_interests', - #'user_likes', - #'user_location', - #'user_notes', - #'user_online_presence', - #'user_photo_video_tags', - #'user_photos', - #'user_relationships', - #'user_religion_politics', - #'user_status', - #'user_videos', - #'user_website', - #'user_work_history', - #'read_friendlists', - #'read_requests', - #'friend_about_me', - #'friend_activites', - #'friend_birthday', - #'friend_education_history', - #'friend_events', - #'friend_groups', - #'friend_hometown', - #'friend_interests', - #'friend_likes', - #'friend_location', - #'friend_notes', - #'friend_online_presence', - #'friend_photo_video_tags', - #'friend_photos', - #'friend_relationships', - #'friend_religion_politics', - #'friend_status', - #'friend_videos', - #'friend_website', - #'friend_work_history', -) - - -AUTHENTICATION_BACKENDS = ( - 'django.contrib.auth.backends.ModelBackend', - 'socialauth.auth_backends.OpenIdBackend', - 'socialauth.auth_backends.TwitterBackend', - 'socialauth.auth_backends.FacebookBackend', - 'socialauth.auth_backends.LinkedInBackend', -) diff --git a/socialauth/lib/oauthtwitter2.py b/socialauth/lib/oauthtwitter2.py index 92577f7..a2f76f6 100644 --- a/socialauth/lib/oauthtwitter2.py +++ b/socialauth/lib/oauthtwitter2.py @@ -2,7 +2,7 @@ import urllib2 import urllib import time -import oauth.oauth as oauth +import oauth2 as oauth from twitter import User from django.conf import settings