[Python-modules-commits] [python-social-auth] 78/322: when scope is reduced, the response from slack is different, handle both

Wolfgang Borgert debacle at moszumanska.debian.org
Sat Dec 24 15:12:51 UTC 2016


This is an automated email from the git hooks/post-receive script.

debacle pushed a commit to tag v0.2.10
in repository python-social-auth.

commit 30ee628c4701adb95f0c93cfc16b570a079ced6f
Author: Nick Sullivan <nick at sullivanflock.com>
Date:   Wed Jan 7 08:23:45 2015 -0800

    when scope is reduced, the response from slack is different, handle both
---
 social/backends/slack.py | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/social/backends/slack.py b/social/backends/slack.py
index 3f6eb0d..5ea49c8 100644
--- a/social/backends/slack.py
+++ b/social/backends/slack.py
@@ -51,10 +51,17 @@ class SlackOAuth2(BaseOAuth2):
             'user': auth_test.get("user_id")
         })
 
-        # Inject the team data
-        out = data["user"].copy()
-        out["team_id"] = auth_test.get("team_id")
-        out["team"] = auth_test.get("team")
-        out["team_url"] = auth_test.get("url")
+        # Capture the user data, if available based on the scope
+        if data.get("user"):
+            out = data["user"].copy()
+            # inject the team data
+            out["team_id"] = auth_test.get("team_id")
+            out["team"] = auth_test.get("team")
+            out["team_url"] = auth_test.get("url")
+        else:
+            out = data.copy()
+            # make the data consistent with the above
+            out["id"] = out["user_id"]
+            del out["user_id"]
 
         return out

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-social-auth.git



More information about the Python-modules-commits mailing list