From: Matías Aguirre Date: Tue, 15 Mar 2011 21:27:26 +0000 (-0300) Subject: Google OAuth2 support X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=c2f36d5f2fb4df80a906587b8f1154105a0ee677;p=django-social-auth.git Google OAuth2 support --- diff --git a/README.rst b/README.rst index 4602fdc..fb81313 100644 --- a/README.rst +++ b/README.rst @@ -102,6 +102,7 @@ Configuration '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.contrib.linkedin.LinkedinBackend', @@ -415,7 +416,30 @@ anonymous values will be used if not configured as described in their GOOGLE_OAUTH_EXTRA_SCOPE = [...] -check which Apps are included in their `Google Data Protocol Directory`_ +Check which applications can be included in their `Google Data Protocol Directory`_ + +------------- +Google OAuth2 +------------- +Recently Google launched OAuth2 support following the definition at +`OAuth2 draft`. It works in a similar way to plain OAuth mechanism, but +developers *must* register an application and apply for a set of keys. Check +`Google OAuth2`_ document for details. + +To enable OAuth2 support: + +- fill "Client Key" and "Client Secret" settings, these values can be obtained + easily as described on `OAuth2 Registering`_ doc:: + + GOOGLE_OAUTH2_CLIENT_KEY = '' + GOOGLE_OAUTH2_CLIENT_SECRET = '' + +- scopes are shared between OAuth mechanisms:: + + GOOGLE_OAUTH_EXTRA_SCOPE = [...] + +Check which applications can be included in their `Google Data Protocol Directory`_ + ------- Testing @@ -513,7 +537,10 @@ Base work is copyrighted by: .. _Orkut API: http://code.google.com/apis/orkut/docs/rest/developers_guide_protocol.html#Authenticating .. _Google OpenID: http://code.google.com/apis/accounts/docs/OpenID.html .. _Google OAuth: http://code.google.com/apis/accounts/docs/OAuth.html +.. _Google OAuth2: http://code.google.com/apis/accounts/docs/OAuth2.html +.. _OAuth2 Registering: http://code.google.com/apis/accounts/docs/OAuth2.html#Registering .. _Google Data Protocol Directory: http://code.google.com/apis/gdata/docs/directory.html +.. _OAuth2 draft: http://tools.ietf.org/html/draft-ietf-oauth-v2-10 .. _OAuth reference: http://code.google.com/apis/accounts/docs/OAuth_ref.html#SigningOAuth .. _Yahoo OpenID: http://openid.yahoo.com/ .. _Twitter OAuth: http://dev.twitter.com/pages/oauth_faq diff --git a/example/local_settings.py.template b/example/local_settings.py.template index c4261cf..a8f1f59 100644 --- a/example/local_settings.py.template +++ b/example/local_settings.py.template @@ -6,6 +6,8 @@ LINKEDIN_CONSUMER_KEY = '' LINKEDIN_CONSUMER_SECRET = '' ORKUT_CONSUMER_KEY = '' ORKUT_CONSUMER_SECRET = '' +GOOGLE_OAUTH2_CLIENT_KEY = '' +GOOGLE_OAUTH2_CLIENT_SECRET = '' SOCIAL_AUTH_CREATE_USERS = True SOCIAL_AUTH_FORCE_RANDOM_USERNAME = False SOCIAL_AUTH_DEFAULT_USERNAME = 'socialauth_user' diff --git a/example/settings.py b/example/settings.py index a0474cc..689f9d1 100644 --- a/example/settings.py +++ b/example/settings.py @@ -65,6 +65,7 @@ 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.contrib.linkedin.LinkedinBackend', diff --git a/example/templates/done.html b/example/templates/done.html index fa2bcdb..b057342 100644 --- a/example/templates/done.html +++ b/example/templates/done.html @@ -34,15 +34,23 @@ {% if orkut %}(disconnect){% endif %}
  • - Google + Google OAuth {% if google_oauth %}(disconnect){% endif %}
  • +

    Associate new OAuth2 credentials:

    + +

    Associate new OpenID credentials:

    +
    +

    Login using OAuth2 from:

    + +
    +

    Login using OpenId from: