third parties.
+-----
+Demo
+-----
+There's a demo at http://social.matiasaguirre.net/.
+Note: It lacks Orkut support at the moment.
+
+
--------
Features
--------
Installation
------------
-Clone from github_::
+From pypi_::
+
+ $ pip install django-social-auth
+
+or::
+
+ $ easy_install django-social-auth
+
+or clone from github_::
- $ git clone git://github.com/Quard/django-social-auth.git
+ $ git clone git://github.com/omab/django-social-auth.git
and add social_auth to PYTHONPATH::
'social_auth.backends.google.GoogleOAuthBackend',
'social_auth.backends.google.GoogleBackend',
'social_auth.backends.yahoo.YahooBackend',
- 'social_auth.backends.linkedin.LinkedinBackend',
+ 'social_auth.backends.contrib.linkedin.LinkedinBackend',
'social_auth.backends.contrib.LiveJournalBackend',
'social_auth.backends.contrib.orkut.OrkutBackend',
'social_auth.backends.OpenIDBackend',
- Twitter and OAuth improvements
+- Quard_ (Vadym Zakovinko)
+
+ - LinkedIn support
----------
.. _Linkedin OAuth: https://www.linkedin.com/secure/developer
.. _Orkut OAuth: http://code.google.com/apis/orkut/docs/rest/developers_guide_protocol.html#Authenticating
.. _myOpenID: https://www.myopenid.com/
+.. _LiveJournal OpenID: http://www.livejournal.com/support/faqbrowse.bml?faqid=283
.. _pypi: http://pypi.python.org/pypi/django-social-auth/
.. _github: https://github.com/omab/django-social-auth
.. _issues in github: https://github.com/omab/django-social-auth/issues
.. _jezdez: https://github.com/jezdez
.. _alfredo: https://github.com/alfredo
.. _mattucf: https://github.com/mattucf
-.. _LiveJournal OpenID: http://www.livejournal.com/support/faqbrowse.bml?faqid=283
+.. _Quard: https://github.com/Quard
"""Login complete view, displays user data"""
names = request.user.social_auth.values_list('provider', flat=True)
ctx = dict((name.lower().replace('-', '_'), True) for name in names)
+ print ctx
ctx['version'] = version
return render_to_response('done.html', ctx, RequestContext(request))
'social_auth.backends.google.GoogleOAuthBackend',
'social_auth.backends.google.GoogleBackend',
'social_auth.backends.yahoo.YahooBackend',
- 'social_auth.backends.linkedin.LinkedinBackend',
+ 'social_auth.backends.contrib.linkedin.LinkedinBackend',
'social_auth.backends.OpenIDBackend',
'social_auth.backends.contrib.livejournal.LiveJournalBackend',
'django.contrib.auth.backends.ModelBackend',
<a rel="nofollow" href="{% url associate_begin "facebook" %}">Facebook</a>
{% if facebook %}<span class="disconnect">(<a href="{% url disconnect "facebook" %}">disconnect</a>)</span>{% endif %}
</li>
+ <li>
+ <a rel="nofollow" href="{% url associate_begin "linkedin" %}">LinkedIn</a>
+ {% if linkedin %}<span class="disconnect">(<a href="{% url disconnect "linkedin" %}">disconnect</a>)</span>{% endif %}
+ </li>
<li>
<a rel="nofollow" href="{% url associate_begin "orkut" %}">Orkut</a>
{% if orkut %}<span class="disconnect">(<a href="{% url disconnect "orkut" %}">disconnect</a>)</span>{% endif %}
No extra configurations are needed to make this work.
"""
import urlparse
-import xml
from xml.etree import ElementTree
-from social_auth.backends import ConsumerBasedOAuth, OAuthBackend, USERNAME
+from social_auth.backends import ConsumerBasedOAuth, OAuthBackend
LINKEDIN_SERVER = 'linkedin.com'
-LINKEDIN_REQUEST_TOKEN_URL = 'https://api.%s/uas/oauth/requestToken' % LINKEDIN_SERVER
-LINKEDIN_ACCESS_TOKEN_URL = 'https://api.%s/uas/oauth/accessToken' % LINKEDIN_SERVER
-LINKEDIN_AUTHORIZATION_URL = 'https://www.%s/uas/oauth/authenticate' % LINKEDIN_SERVER
+LINKEDIN_REQUEST_TOKEN_URL = 'https://api.%s/uas/oauth/requestToken' % \
+ LINKEDIN_SERVER
+LINKEDIN_ACCESS_TOKEN_URL = 'https://api.%s/uas/oauth/accessToken' % \
+ LINKEDIN_SERVER
+LINKEDIN_AUTHORIZATION_URL = 'https://www.%s/uas/oauth/authenticate' % \
+ LINKEDIN_SERVER
LINKEDIN_CHECK_AUTH = 'https://api.%s/v1/people/~' % LINKEDIN_SERVER
return True
-# Backend definition
-BACKENDS = {
- 'linkedin': LinkedinAuth,
-}
-
-
def _xml_to_dict(xml):
+ """Convert xml structure to dict"""
data = {}
for child in xml.getchildren():
if child.getchildren():
data[child.tag] = child.text
return data
+
+
+# Backend definition
+BACKENDS = {
+ 'linkedin': LinkedinAuth,
+}