diff --git a/docs/backends/google.rst b/docs/backends/google.rst index aa1c970b7..1ef2dce52 100644 --- a/docs/backends/google.rst +++ b/docs/backends/google.rst @@ -6,6 +6,11 @@ This section describes how to setup the different services provided by Google. Google OAuth ------------ +.. attention:: **Google OAuth deprecation** + Important: OAuth 1.0 was officially deprecated on April 20, 2012, and will be + shut down on April 20, 2015. We encourage you to migrate to any of the other + protocols. + Google provides ``Consumer Key`` and ``Consumer Secret`` keys to registered applications, but also allows unregistered application to use their authorization system with, but beware that this method will display a security banner to the @@ -59,69 +64,72 @@ done by their Javascript which thens calls a defined handler to complete the auth process. * To enable the backend create an application using the `Google console`_ and - fill the key settings:: + following the steps from the `official guide`_. + +* Fill in the key settings looking inside the Google console the subsection + ``Credentials`` inside ``API & auth``:: + + AUTHENTICATION_BACKENDS = ( + ... + 'social.backends.google.GooglePlusAuth', + ) SOCIAL_AUTH_GOOGLE_PLUS_KEY = '...' SOCIAL_AUTH_GOOGLE_PLUS_SECRET = '...' -* Add their button snippet to your template:: + ``SOCIAL_AUTH_GOOGLE_PLUS_KEY`` corresponds to the variable ``CLIENT ID``. + ``SOCIAL_AUTH_GOOGLE_PLUS_SECRET`` corresponds to the variable + ``CLIENT SECRET``. + +* Create a new Django view and in its template add the Google+ Sign-In button::
- + +
- ``signInCallback`` is the name of your Javascript callback function. - -* The scope can be generated doing:: - - from social.backends.google import GooglePlusAuth - plus_scope = ' '.join(GooglePlusAuth.DEFAULT_SCOPE) +
+ {% csrf_token %} + + +
- Or get the value from settings if it was overridden. ``plus_id`` is the value - from ``SOCIAL_AUTH_GOOGLE_PLUS_KEY``. + ``plus_id`` is the value from ``SOCIAL_AUTH_GOOGLE_PLUS_KEY``. + ``signInCallback`` is the name of your Javascript callback function. -* Add the Javascript snippet:: +* Add the Javascript snippet in the same template as above:: - + -* Define your Javascript callback function:: +* And define your Javascript callback function:: - In the example above the values needed to complete the auth process are - posted using a form like this but this is just a simple example:: - -
{% csrf_token %} - - -
- Google OpenId ------------- @@ -208,5 +216,6 @@ supporting them you can default to the old values by defining this setting:: .. _whitelists: ../configuration/settings.html#whitelists .. _Google+ Sign In: https://developers.google.com/+/web/signin/ .. _Google console: https://code.google.com/apis/console +.. _official guide: https://developers.google.com/+/web/signin/#step_1_create_a_client_id_and_client_secret .. _Sept 1, 2014: https://developers.google.com/+/api/auth-migration#timetable .. _e3525187: https://github.com/omab/python-social-auth/commit/e35251878a88954cecf8e575eca27c63164b9f67