cyrildoussin / Django-Socialauth forked from uswaretech/Django-Socialauth

Allows logging via Facebook, Yahoo, Gmail, Twitter and Openid

This URL has Read+Write access

cyrildoussin (author)
Wed Oct 07 05:26:37 -0700 2009
commit  c89650b14066c9f011df3419ef1315b17f2b08fe
tree    2c6def5188b6ab430e5dea976c81b83e896992c7
parent  0f4e76f134884199183835f0cd1232a24c93cf95
name age message
file .gitignore Wed Aug 26 05:12:45 -0700 2009 Exported from App [shabda]
file LICENSE Sun Sep 06 01:02:56 -0700 2009 Fixes #1, #3 [shabda]
file README Wed Aug 26 05:43:13 -0700 2009 Cleaned README [shabda]
file __init__.py Wed Aug 26 05:12:45 -0700 2009 Exported from App [shabda]
directory commentor/ Tue Oct 06 02:51:27 -0700 2009 show which account the user is logged under whe... [cyrildoussin]
file ez_setup.py Sun Sep 06 01:26:36 -0700 2009 Add to pypi [shabda]
file gitignore Wed Aug 26 05:12:45 -0700 2009 Exported from App [shabda]
file localsettings.example.py Sun Oct 04 07:28:14 -0700 2009 Cleaned up code. [shabda]
file manage.py Wed Aug 26 05:12:45 -0700 2009 Exported from App [shabda]
directory openid_consumer/ Sun Oct 04 03:28:03 -0700 2009 Cleaned up codebase [shabda]
file settings.py Tue Oct 06 02:49:53 -0700 2009 remove "socialauthdemo" prefix to urls, as when... [cyrildoussin]
file setup.py Loading commit data...
file social_authentication.kpf Wed Aug 26 05:12:45 -0700 2009 Exported from App [shabda]
directory socialauth/
file urls.py Mon Oct 05 05:47:48 -0700 2009 Cleaned up codebase [shabda]
README
What it does.
-----------------
1. Allow logging in via various providers.
2. Import contacts from various third party sites, to find out which of your
friends already use our service.

Logging In
================


This is a application to enable authentication via various third party sites.
In particular it allows logging in via
1. Twitter
2. Gmail
3. Facebook
4. Yahoo(Essentially openid)
4. OpenId

Libs you need to install
1. python-openid (easy_install)
2. Yadis (easy_install)
3. python-openauth(easy_install)


The API Keys are available from

http://www.facebook.com/developers/createapp.php 
https://developer.yahoo.com/dashboard/createKey.html
https://www.google.com/accounts/ManageDomains
http://twitter.com/oauth_clients 

How it works.
-------------------
Openid: Users need to provide their openid providers. Talk to the providers and
login.
Yahoo: Yahoo is an openid provider. Talk to Yahoo endpoints. (Endpoint: http://yahoo.com)
Google: Google is a provider. Talk to them. (Endpoint: https://www.google.com/accounts/o8/id)
Facebook: Facebook connect provides authentication framework.
Twitter: We use Twitter Oauth for authentication. In theory, Oauth shouldn't be
used for authentication. (It is an autorisation framework, not an authentication one),
In practice it works pretty well. Once you have an access_token, and a name, essentially
authenticated.

References
1. http://openid.net/developers/
2. http://developer.yahoo.com/openid/
3. http://code.google.com/apis/accounts/docs/OpenID.html
4. http://apiwiki.twitter.com/OAuth-FAQ
5. http://developers.facebook.com/connect.php

Limitations
--------------

As with all APIs, we are limited by the amout of data which the API provider
provides us. For example, both Yahoo and Google provide extremely limited data
about the autheticated subscriber. Twitter and Facebook provide a lot of details,
but not the email. Different Openid providers are free to provide [different
amounts of data](http://openid.net/specs/openid-simple-registration-extension-1_0.html).

How it works.
-----------------
1. For all providers(except Facebook) there are two urls and views. (start and done)
2. Start sets up the required tokens, and redirects and hands off to the correct
provider.
3. Provider handles authentication on their ends, and hands off to Us, providing
authorization tokens.
4. In done, we check if the user with these details already exists, if yes, we
log them in. Otherwise we create a new user, and log them in.

For all of these, we use standard django authenication system, with custom
auth_backends, hence all existing views, and decorators as login_required
will work as expected.

Urls
---------

/login/ Login page. Has all the login options
/openid_login/ AND /openid_login/done/
/yahoo_login/ AND /yahoo_login/done/
/gmail_login/ AND /gmail_login/done/
/twitter_login/ AND /twitter_login/done/
/facebook_login/done/ We dont have a start url here, as the starting tokens are
set in a popup, as per FB Connect recommendations.

Implementation
----------------
0. Install required libraries.
1. Get tokens and populate in localsettings.py
2. Set the token callback urls correctly at Twitter and Facebook.
4. Set the authentication_backends to the providers you are using.