Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions docs/backends/aol.rst

This file was deleted.

2 changes: 1 addition & 1 deletion docs/backends/bungie.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Bungie uses OAuth 2.0 for authentication.

AUTHENTICATION_BACKENDS = (
...
'social_core.backends.bungie.BungieBaseAuth',
'social_core.backends.bungie.BungieOAuth2',
...
)

Expand Down
28 changes: 1 addition & 27 deletions docs/backends/douban.rst
Original file line number Diff line number Diff line change
@@ -1,31 +1,7 @@
Douban
======

Douban supports OAuth 1 and 2.

Douban OAuth1
-------------

Douban OAuth 1 works similar to Twitter OAuth.

Douban offers per application keys named ``Consumer Key`` and ``Consumer
Secret``. To enable Douban OAuth these two keys are needed. Further
documentation at `Douban Services & API`_:

- Register a new application at `Douban API Key`_, make sure to mark the **web
application** checkbox.

- Fill **Consumer Key** and **Consumer Secret** values in settings::

SOCIAL_AUTH_DOUBAN_KEY = ''
SOCIAL_AUTH_DOUBAN_SECRET = ''

- Add ``'social_core.backends.douban.DoubanOAuth'`` into your
``SOCIAL_AUTH_AUTHENTICATION_BACKENDS``.


Douban OAuth2
-------------
Douban supports OAuth2.

Recently Douban launched their OAuth2 support and the new developer site, you
can find documentation at `Douban Developers`_. To setup OAuth2 follow:
Expand All @@ -41,7 +17,5 @@ can find documentation at `Douban Developers`_. To setup OAuth2 follow:
- Add ``'social_core.backends.douban.DoubanOAuth2'`` into your
``SOCIAL_AUTH_AUTHENTICATION_BACKENDS``.

.. _Douban Services & API: http://www.douban.com/service/
.. _Douban API Key: http://www.douban.com/service/apikey/apply
.. _Douban Developers: http://developers.douban.com/
.. _Create A Douban App : http://developers.douban.com/apikey/apply
44 changes: 3 additions & 41 deletions docs/backends/dropbox.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
Dropbox
=======

Dropbox supports both OAuth 1 and 2.
Dropbox supports OAuth2.

- Register a new application at `Dropbox Developers`_, and follow the
instructions below for the version of OAuth for which you are adding
support.
- Register a new application at `Dropbox Developers`_.


OAuth2 Api V2
Expand All @@ -15,43 +13,7 @@ Add the Dropbox OAuth2 backend to your settings page::

SOCIAL_AUTH_AUTHENTICATION_BACKENDS = (
...
'social.backends.dropbox.DropboxOAuth2V2',
...
)

- Fill ``App Key`` and ``App Secret`` values in the settings::

SOCIAL_AUTH_DROPBOX_OAUTH2_KEY = ''
SOCIAL_AUTH_DROPBOX_OAUTH2_SECRET = ''

OAuth1
------

.. deprecated:: V1 api is deprecated. https://blogs.dropbox.com/developers/2016/06/api-v1-deprecated/

Add the Dropbox OAuth backend to your settings page::

SOCIAL_AUTH_AUTHENTICATION_BACKENDS = (
...
'social_core.backends.dropbox.DropboxOAuth',
...
)

- Fill ``App Key`` and ``App Secret`` values in the settings::

SOCIAL_AUTH_DROPBOX_KEY = ''
SOCIAL_AUTH_DROPBOX_SECRET = ''

OAuth2
------

.. deprecated:: V1 api is deprecated. https://blogs.dropbox.com/developers/2016/06/api-v1-deprecated/

Add the Dropbox OAuth2 backend to your settings page::

SOCIAL_AUTH_AUTHENTICATION_BACKENDS = (
...
'social_core.backends.dropbox.DropboxOAuth2',
'social_core.backends.dropbox.DropboxOAuth2V2',
...
)

Expand Down
157 changes: 2 additions & 155 deletions docs/backends/google.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,118 +125,6 @@ on the client side. Because of this `start` url is not available, only a `comple



Google+ Sign-In
---------------

`Google+ Sign In`_ works a lot like OAuth2, but most of the initial work is
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 following the steps from the `official guide`_. Make
sure to enable the Google+ API in the console.

* Fill in the key settings looking inside the Google console the subsection
``Credentials`` inside ``API & auth``::

AUTHENTICATION_BACKENDS = (
...
'social_core.backends.google.GooglePlusAuth',
)

SOCIAL_AUTH_GOOGLE_PLUS_KEY = '...'
SOCIAL_AUTH_GOOGLE_PLUS_SECRET = '...'

``SOCIAL_AUTH_GOOGLE_PLUS_KEY`` corresponds to the variable ``CLIENT ID``.
``SOCIAL_AUTH_GOOGLE_PLUS_SECRET`` corresponds to the variable
``CLIENT SECRET``.

* Add the sign-in button to your template, you can use the SDK button
or add your own and attach the click handler to it (check `Google+ Identity Sign-In`_
documentation about it)::

<div id="google-plus-button">Google+ Sign In</div>

* Add the Javascript snippet in the same template as above::

<script src="https://apis.google.com/js/api:client.js"></script>

<script type="text/javascript">
gapi.load('auth2', function () {
var auth2;

auth2 = gapi.auth2.init({
client_id: "<PUT SOCIAL_AUTH_GOOGLE_PLUS_KEY HERE>",
scope: "<PUT BACKEND SCOPE HERE>"
});

auth2.then(function () {
var button = document.getElementById("google-plus-button");
console.log("User is signed-in in Google+ platform?", auth2.isSignedIn.get() ? "Yes" : "No");

auth2.attachClickHandler(button, {}, function (googleUser) {
// Send access-token to backend to finish the authenticate
// with your application

var authResponse = googleUser.getAuthResponse();
var $form;
var $input;

$form = $("<form>");
$form.attr("action", "/complete/google-plus");
$form.attr("method", "post");
$input = $("<input>");
$input.attr("name", "id_token");
$input.attr("value", authResponse.id_token);
$form.append($input);
// Add csrf-token if needed
$(document.body).append($form);
$form.submit();
});
});
});
</script>

* Logging out

Logging-out can be tricky when using the the platform SDK because it
can trigger an automatic sign-in when listening to the user status
change. With the method show above, that won't happen, but if the UI
depends more in the SDK values than the backend, then things can get
out of sync easily. To prevent this, the user should be logged-out
from Google+ platform too. This can be accomplished by doing::

<script type="text/javascript">
gapi.load('auth2', function () {
var auth2;

auth2 = gapi.auth2.init({
client_id: "{{ plus_id }}",
scope: "{{ plus_scope }}"
});

auth2.then(function () {
if (auth2.isSignedIn.get()) {
$('#logout').on('click', function (event) {
event.preventDefault();
auth2.signOut().then(function () {
console.log("Logged out from Google+ platform");
document.location = "/logout";
});
});
}
});
});
</script>


Google OpenID
-------------

Google OpenID works straightforward, no settings are needed. Domains or emails
whitelists can be applied too, check the whitelists_ settings for details.


Orkut
-----

Expand All @@ -261,50 +149,14 @@ Refresh Tokens
--------------

To get an OAuth2 refresh token along with the access token, you must pass an extra argument: ``access_type=offline``.
To do this with Google+ sign-in::
To do this with Google OAuth2::

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore docs for the still-shipped Google+ backend

This replacement is part of removing the Google+ Sign-In section as if that backend disappeared, but social_core.backends.google.GooglePlusAuth is still shipped with provider name google-plus. Users of that backend now lose the only docs for SOCIAL_AUTH_GOOGLE_PLUS_* settings and the /complete/google-plus client-side flow while the code remains available; restore or explicitly deprecate the section instead of dropping it as removed.

Useful? React with 👍 / 👎.


SOCIAL_AUTH_GOOGLE_PLUS_AUTH_EXTRA_ARGUMENTS = {
SOCIAL_AUTH_GOOGLE_OAUTH2_AUTH_EXTRA_ARGUMENTS = {
'access_type': 'offline'
}


Scopes deprecation
------------------

Google is deprecating the full-url scopes from `Sept 1, 2014`_ in favor of
``Google+ API`` and the recently introduced shorter scopes names. But
``python-social-auth`` already introduced the scopes change at e3525187_ which
was released at ``v0.1.24``.

But, to enable the new scopes the application requires ``Google+ API`` to be
enabled in the `Google console`_ dashboard, the change is quick and quite
simple, but if any developer desires to keep using the old scopes, it's
possible with the following settings::

# Google OAuth2 (google-oauth2)
SOCIAL_AUTH_GOOGLE_OAUTH2_IGNORE_DEFAULT_SCOPE = True
SOCIAL_AUTH_GOOGLE_OAUTH2_SCOPE = [
'https://www.googleapis.com/auth/userinfo.email',
'https://www.googleapis.com/auth/userinfo.profile'
]

# Google+ SignIn (google-plus)
SOCIAL_AUTH_GOOGLE_PLUS_IGNORE_DEFAULT_SCOPE = True
SOCIAL_AUTH_GOOGLE_PLUS_SCOPE = [
'https://www.googleapis.com/auth/plus.login',
'https://www.googleapis.com/auth/userinfo.email',
'https://www.googleapis.com/auth/userinfo.profile'
]

To ease the change, the old API and scopes is still supported by the
application, the new values are the default option but if having troubles
supporting them you can default to the old values by defining this setting::

SOCIAL_AUTH_GOOGLE_OAUTH2_USE_DEPRECATED_API = True
SOCIAL_AUTH_GOOGLE_PLUS_USE_DEPRECATED_API = True

.. _Google support: http://www.google.com/support/a/bin/answer.py?hl=en&answer=162105
.. _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
Expand All @@ -313,12 +165,7 @@ supporting them you can default to the old values by defining this setting::
.. _shut down: https://support.google.com/orkut/?csw=1#Authenticating
.. _Google Data Protocol Directory: http://code.google.com/apis/gdata/docs/directory.html
.. _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
.. _Google+ Identity Sign-In: https://developers.google.com/identity/sign-in/web/sign-in
.. _Google One Tap: https://developers.google.com/identity/gsi/web/guides/features
.. _related issue: https://issuetracker.google.com/issues/226157137
.. _One Tap snippet: https://developers.google.com/identity/gsi/web/guides/display-google-one-tap
Expand Down
7 changes: 0 additions & 7 deletions docs/backends/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ Social backends

amazon
angel
aol
apple
arcgis
auth0
Expand Down Expand Up @@ -98,7 +97,6 @@ Social backends
justgiving
kakao
keycloak
khanacademy
kick
lastfm
launchpad
Expand All @@ -118,14 +116,12 @@ Social backends
microsoftgraph
mineid
mixcloud
naszaklasa
nationbuilder
naver
nfdi
ngpvan_actionid
odnoklassnikiru
okta
openstreetmap
openstreetmap_oauth2
oidc
orbi
Expand All @@ -139,12 +135,10 @@ Social backends
qiita
qq
quizlet
rdio
reddit
runkeeper
salesforce
seznam
shimmering
shopify
simplelogin
sketchfab
Expand All @@ -160,7 +154,6 @@ Social backends
stripe
taobao
telegram
thisismyjam
trello
tripit
tumblr
Expand Down
25 changes: 0 additions & 25 deletions docs/backends/khanacademy.rst

This file was deleted.

2 changes: 1 addition & 1 deletion docs/backends/livejournal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ work, beside being defined on ``AUTHENTICATION_BACKENDS```::

SOCIAL_AUTH_AUTHENTICATION_BACKENDS = (
...
'social_core.backends.aol.AOLOpenId',
'social_core.backends.livejournal.LiveJournalOpenId',
...
)

Expand Down
Loading