import logging
logger = logging.getLogger(__name__)
-from os import walk
-from os.path import basename
from urllib2 import Request, urlopen
from urllib import urlencode
from urlparse import urlsplit
-from collections import defaultdict
from openid.consumer.consumer import Consumer, SUCCESS, CANCEL, FAILURE
from openid.consumer.discover import DiscoveryFailure
from django.utils import simplejson
from django.utils.importlib import import_module
-from social_auth.models import UserSocialAuth
from social_auth.utils import setting
from social_auth.store import DjangoOpenIDStore
from social_auth.backends.exceptions import StopPipeline
from social_auth.backends import ConsumerBasedOAuth, OAuthBackend, USERNAME
+
# Dropbox configuration
DROPBOX_SERVER = 'dropbox.com'
DROPBOX_API = 'api.%s' % DROPBOX_SERVER
return {USERNAME: response.get('uid'),
'email': response.get('email'),
'first_name': response.get('display_name')}
-
+
def get_user_id(self, details, response):
"""OAuth providers return an unique user id in response"""
# Dropbox uses a uid parameter instead of id like most others...
return response['uid']
+
class DropboxAuth(ConsumerBasedOAuth):
"""Dropbox OAuth authentication mechanism"""
AUTHORIZATION_URL = DROPBOX_AUTHORIZATION_URL
('DROPBOX_APP_ID',
'DROPBOX_API_SECRET'))
+
# Backend definition
BACKENDS = {
'dropbox': DropboxAuth,
from cgi import parse_qs
from django.conf import settings
-from django.utils import simplejson
from oauth2 import Token
from social_auth.backends import ConsumerBasedOAuth, OAuthBackend, USERNAME
+
# Flickr configuration
FLICKR_SERVER = 'http://www.flickr.com/services'
FLICKR_REQUEST_TOKEN_URL = '%s/oauth/request_token' % FLICKR_SERVER
+import urllib
import logging
logger = logging.getLogger(__name__)
-import urllib
-
from django.utils import simplejson
from social_auth.backends import BaseOAuth2, OAuthBackend, USERNAME
By default account id and token expiration time are stored in extra_data
field, check OAuthBackend class for details on how to extend it.
"""
+import cgi
+import urllib
import logging
logger = logging.getLogger(__name__)
-import cgi
-import urllib
from django.conf import settings
from django.utils import simplejson
This contribution adds support for LiveJournal OpenID service in the form
username.livejournal.com. Username is retrieved from the identity url.
"""
+import urlparse
import logging
logger = logging.getLogger(__name__)
-import urlparse
-
from social_auth.backends import OpenIDBackend, OpenIdAuth, USERNAME
OAuth settings ORKUT_CONSUMER_KEY and ORKUT_CONSUMER_SECRET are needed
to enable this service support.
"""
+import urllib
import logging
logger = logging.getLogger(__name__)
-import urllib
-
from django.conf import settings
from django.utils import simplejson
from django.conf import settings
from django.db.utils import IntegrityError
-from social_auth.models import User, UserSocialAuth
+from social_auth.models import UserSocialAuth
from social_auth.backends.pipeline import warn_setting
from django.conf import settings
from social_auth.models import User
-from social_auth.backends.pipeline import USERNAME, USERNAME_MAX_LENGTH, warn_setting
+from social_auth.backends.pipeline import USERNAME, USERNAME_MAX_LENGTH, \
+ warn_setting
from social_auth.signals import socialauth_not_registered, \
socialauth_registered, \
pre_update