From 52c63898779cb39e19a262f6b1c9d20b210ebe45 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mat=C3=ADas=20Aguirre?= Date: Sun, 12 Feb 2012 16:30:43 -0200 Subject: [PATCH] Instagram doc and small code styling. Refs #247 --- README.rst | 13 +++++++------ doc/backends/index.rst | 2 ++ doc/backends/instagram.rst | 18 ++++++++++++++++++ social_auth/backends/contrib/instagram.py | 8 ++++---- 4 files changed, 31 insertions(+), 10 deletions(-) create mode 100644 doc/backends/instagram.rst diff --git a/README.rst b/README.rst index 794faea..9d417c0 100644 --- a/README.rst +++ b/README.rst @@ -790,9 +790,9 @@ include in your document and the needed mechanism to trigger the POST to Check the second "Use Case" for an implementation example. -------- +--------- Instagram -------- +--------- Instagram uses OAuth v2 for Authentication - Register a new application at the `Instagram API`_, and @@ -802,10 +802,11 @@ Instagram uses OAuth v2 for Authentication INSTAGRAM_CLIENT_ID = '' INSTAGRAM_CLIENT_SECRET = '' -None: Instagram only allows one callback url so you'll have to change your urls.py to -accomodate both /complete and /associate routes, for example by having a single -/associate url which takes a ?complete=true parameter for the cases when you want -to complete rather than associate. +*Note:* +Instagram only allows one callback url so you'll have to change your urls.py to +accomodate both ``/complete`` and ``/associate`` routes, for example by having +a single ``/associate`` url which takes a ``?complete=true`` parameter for the +cases when you want to complete rather than associate. ------- diff --git a/doc/backends/index.rst b/doc/backends/index.rst index 4cb8465..d4dba77 100644 --- a/doc/backends/index.rst +++ b/doc/backends/index.rst @@ -13,3 +13,5 @@ Contents: facebook linkedin github + browserid + instagram diff --git a/doc/backends/instagram.rst b/doc/backends/instagram.rst new file mode 100644 index 0000000..2bc4260 --- /dev/null +++ b/doc/backends/instagram.rst @@ -0,0 +1,18 @@ +Instagram +========= +Instagram uses OAuth v2 for Authentication + +- Register a new application at the `Instagram API`_, and + +- fill ``Client Id`` and ``Client Secret`` values in the settings:: + + INSTAGRAM_CLIENT_ID = '' + INSTAGRAM_CLIENT_SECRET = '' + +*Note:* +Instagram only allows one callback url so you'll have to change your urls.py to +accomodate both ``/complete`` and ``/associate`` routes, for example by having +a single ``/associate`` url which takes a ``?complete=true`` parameter for the +cases when you want to complete rather than associate. + +.. _Instagram API: http://instagr.am/developer/ diff --git a/social_auth/backends/contrib/instagram.py b/social_auth/backends/contrib/instagram.py index afdbafe..e2fba7d 100644 --- a/social_auth/backends/contrib/instagram.py +++ b/social_auth/backends/contrib/instagram.py @@ -22,10 +22,10 @@ class InstagramBackend(OAuthBackend): username = response['user']['username'] fullname = response['user'].get('fullname', '') email = response['user'].get('email', '') - - return {USERNAME: username, - 'first_name': fullname, - 'email': email + return { + USERNAME: username, + 'first_name': fullname, + 'email': email } -- 2.39.5